OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{StringTransform.h} Namespace Reference

Functions

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

Function Documentation

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

Definition at line 134 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: