OmniSciDB  2e3a973ef4
anonymous_namespace{StringTransform.h} Namespace Reference

Classes

struct  declval< T >().get() ->toString(), void())>
 
struct  get_has_toString
 
struct  has_toString
 
struct  has_toString< T, decltype(std::declval< T >().toString(), void())>
 

Functions

template<typename T >
decltype(auto) stringlike (T &&parm)
 

Variables

template<class T >
constexpr bool has_toString_v = has_toString<T>::value
 
template<class T >
constexpr bool get_has_toString_v = get_has_toString<T>::value
 

Function Documentation

◆ stringlike()

template<typename T >
decltype(auto) anonymous_namespace{StringTransform.h}::stringlike ( T &&  parm)
inline

Definition at line 129 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

129  {
130  // String.
131  if constexpr (std::is_base_of_v<std::string, std::remove_reference_t<decltype(parm)>>) {
132  return std::forward<T>(parm);
133  }
134 
135  // Char Array.
136  else if constexpr (std::is_array_v<std::remove_reference_t<decltype(parm)>>) {
137  return std::forward<T>(parm);
138  }
139 
140  // Char String.
141  else if constexpr (std::is_same_v<std::remove_reference_t<decltype(parm)>,
142  const char*> ||
143  std::is_same_v<std::remove_reference_t<decltype(parm)>, char*>) {
144  return std::forward<T>(parm);
145  }
146 
147  // Integer or Floating Point.
148  else if constexpr (std::is_integral_v<std::remove_reference_t<decltype(parm)>> ||
149  std::is_floating_point_v<std::remove_reference_t<decltype(parm)>>) {
150  return std::to_string(std::forward<T>(parm));
151  }
152 
153  // Unsupported type that will fail at compile-time.
154  else {
155  static_assert(std::is_base_of_v<void, decltype(parm)>);
156  return std::string(); // unreachable, but needed to avoid extra error messages
157  }
158 }
std::string to_string(T &&v)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ get_has_toString_v

template<class T >
constexpr bool anonymous_namespace{StringTransform.h}::get_has_toString_v = get_has_toString<T>::value
inline

Definition at line 239 of file StringTransform.h.

◆ has_toString_v

template<class T >
constexpr bool anonymous_namespace{StringTransform.h}::has_toString_v = has_toString<T>::value
inline

Definition at line 231 of file StringTransform.h.