Lumiera  0.pre.03
»edit your freedom«
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 172 of file meta/util.hpp.

Static Public Member Functions

template<class XX >
static Yes_t check_explicit (Probe< XX > *)
 
template<class >
static No_t check_explicit (...)
 
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 (...)
 

Static Public Attributes

static const bool value
 

Classes

struct  Probe
 

Class Documentation

◆ lib::meta::can_convertToString::Probe

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

Member Data Documentation

◆ value

const bool value
static
Initial value:
= (sizeof(Yes_t)==sizeof(check_implicit (std::declval<X>())))
or (sizeof(Yes_t)==sizeof(check_explicit<X>(0)))

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

+ Collaboration diagram for can_convertToString< X >:

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