Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
can_convertToString< X > Struct Template Reference

#include "lib/meta/util.hpp"

Description

template<typename X>
struct lib::meta::can_convertToString< X >

detect possibility of a conversion to string.

Naive implementation, which first attempts to build a string instance by implicit conversion, and then tries to invoke an explicit string conversion. The embedded constant value will be true in case any of this succeeds. Might fail in more tricky situations (references, const, volatile)

See also
format-obj.hpp more elaborate solution including lexical_cast

Definition at line 167 of file meta/util.hpp.

Classes

struct  Probe
 

Static Public Attributes

static const bool value
 

Static Public Member Functions

static Yes_t check_implicit (std::string)
 
static Yes_t check_implicit (std::string_view)
 
static Yes_t check_implicit (const char *)
 
static No_t check_implicit (...)
 
template<class XX >
static Yes_t check_explicit (Probe< XX > *)
 
template<class >
static No_t check_explicit (...)
 

Class Documentation

◆ lib::meta::can_convertToString::Probe

struct lib::meta::can_convertToString::Probe
+ Collaboration diagram for can_convertToString< X >::Probe< XX, i >:

Member Function Documentation

◆ check_implicit() [1/4]

template<typename X >
static Yes_t check_implicit ( std::string  )
static

◆ check_implicit() [2/4]

template<typename X >
static Yes_t check_implicit ( std::string_view  )
static

◆ check_implicit() [3/4]

template<typename X >
static Yes_t check_implicit ( const char )
static

◆ check_implicit() [4/4]

template<typename X >
static No_t check_implicit (   ...)
static

◆ check_explicit() [1/2]

template<typename X >
template<class XX >
static Yes_t check_explicit ( Probe< XX > *  )
static

◆ check_explicit() [2/2]

template<typename X >
template<class >
static No_t check_explicit (   ...)
static

Member Data Documentation

◆ value

template<typename X >
const bool value
static
Initial value:
= (sizeof(Yes_t)==sizeof(check_implicit (std::declval<X>())))
or (sizeof(Yes_t)==sizeof(check_explicit<X>(0)))
char Yes_t
helper types to detect the overload resolution chosen by the compiler
Definition meta/util.hpp:99
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
static Yes_t check_implicit(std::string)

Definition at line 186 of file meta/util.hpp.

+ Collaboration diagram for can_convertToString< X >:

The documentation for this struct was generated from the following file: