Program Listing for File detector.hpp

Return to documentation for file (rcppsw/mpl/detail/detector.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcppsw/rcppsw.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace rcppsw::mpl::detail {

/*******************************************************************************
 * Trait Detection Templates
 ******************************************************************************/
template <class TFailType,
          class AlwaysVoid,
          template <class...>
          class TFuncDecltype,
          class... Args>
struct detector {
  using value = std::false_type;

  using type = TFailType;
};

template <class TFailType,
          template <class...>
          class TFuncDecltype,
          class... Args>
struct detector<TFailType,
                std::void_t<TFuncDecltype<Args...>>,
                TFuncDecltype,
                Args...> {
  using value = std::true_type;

  using type = TFuncDecltype<Args...>;
};

template <class T, std::size_t = sizeof(T)>
std::true_type is_complete_impl(T *);

std::false_type is_complete_impl(...);

} /* namespace rcppsw::mpl::detail */