COMMS
Template library intended to help with implementation of communication protocols.
Functions
comms::util::detect Namespace Reference

Namespace for various compile-time detection operations of whether a type has certain member types and/or member functions. More...

Detailed Description

Namespace for various compile-time detection operations of whether a type has certain member types and/or member functions.

Functions

template<typename T >
constexpr bool hasAssignFunc ()
 Detect whether provided type has assign() member function which can receive two pointers in its arguments. More...
 
template<typename T >
constexpr bool hasClearFunc ()
 Detect whether provided type has clear() member function. More...
 
template<typename T >
constexpr bool hasMaxSizeFunc ()
 Detect whether provided type has max_size() member function. More...
 
template<typename T >
constexpr bool hasPtrSizeConstructor ()
 Detect whether provided type has a constructor that receives a pointer + size parameters. More...
 
template<typename T >
constexpr bool hasRemoveSuffixFunc ()
 Detect whether provided type has remove_suffix() member function. More...
 
template<typename T >
constexpr bool hasReserveFunc ()
 Detect whether provided type has reserve() member function. More...
 
template<typename T >
constexpr bool hasResizeFunc ()
 Detect whether provided type has resize() member function. More...
 
template<typename T >
constexpr bool isStdSpan ()
 Detect whether provided type is std::span.
 

Function Documentation

◆ hasAssignFunc()

template<typename T >
constexpr bool comms::util::detect::hasAssignFunc ( )
constexpr

Detect whether provided type has assign() member function which can receive two pointers in its arguments.

static_assert(comms::util::detect::HasAssignFunc<std::string>(), "std::string is expected to have assign() member function.");

◆ hasClearFunc()

template<typename T >
constexpr bool comms::util::detect::hasClearFunc ( )
constexpr

Detect whether provided type has clear() member function.

static_assert(comms::util::detect::hasClearFunc<std::string>(), "std::string is expected to have clear() member function.");

◆ hasMaxSizeFunc()

template<typename T >
constexpr bool comms::util::detect::hasMaxSizeFunc ( )
constexpr

Detect whether provided type has max_size() member function.

static_assert(comms::util::detect::hasMaxSizeFunc<std::string>(), "std::string is expected to have max_size() member function.");

◆ hasPtrSizeConstructor()

template<typename T >
constexpr bool comms::util::detect::hasPtrSizeConstructor ( )
constexpr

Detect whether provided type has a constructor that receives a pointer + size parameters.

static_assert(comms::util::detect::hasPtrSizeConstructor<std::string_view>(),
"std::string_view is expected to have ptr + size constructor.");

◆ hasRemoveSuffixFunc()

template<typename T >
constexpr bool comms::util::detect::hasRemoveSuffixFunc ( )
constexpr

Detect whether provided type has remove_suffix() member function.

static_assert(comms::util::detect::hasRemoveSuffixFunc<comms::util::StringView>,
"comms::util::StringView is expected to have remove_suffix() member function.");
static_assert(comms::util::detect::hasRemoveSuffixFunc<std::string_view>,
"std::string_view is expected to have remove_suffix() member function.");

◆ hasReserveFunc()

template<typename T >
constexpr bool comms::util::detect::hasReserveFunc ( )
constexpr

Detect whether provided type has reserve() member function.

static_assert(comms::util::detect::hasReserveFunc<std::string>(), "std::string is expected to have reserve() member function.");

◆ hasResizeFunc()

template<typename T >
constexpr bool comms::util::detect::hasResizeFunc ( )
constexpr

Detect whether provided type has resize() member function.

static_assert(comms::util::detect::hasResizeFunc<std::string>(), "std::string is expected to have resize() member function.");