OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 144 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

144  {
145  // String.
146  if constexpr (std::is_base_of_v<std::string,
147  std::remove_reference_t<decltype(parm)>>) { // NOLINT
148  return std::forward<T>(parm);
149 
150  // Char Array.
151 
152  } else if constexpr (std::is_array_v<
153  std::remove_reference_t<decltype(parm)>>) { // NOLINT
154  return std::forward<T>(parm);
155 
156  // Char String.
157 
158  } else if constexpr (std::is_same_v<std::remove_reference_t<decltype(parm)>,
159  const char*> ||
160  std::is_same_v<std::remove_reference_t<decltype(parm)>,
161  char*>) { // NOLINT
162  return std::forward<T>(parm);
163 
164  // Integer or Floating Point.
165 
166  } else if constexpr (std::is_integral_v<std::remove_reference_t<decltype(parm)>> ||
167  std::is_floating_point_v<
168  std::remove_reference_t<decltype(parm)>>) { // NOLINT
169  return std::to_string(std::forward<T>(parm));
170  }
171 
172  // Unsupported type that will fail at compile-time.
173  else {
174  static_assert(std::is_base_of_v<void, decltype(parm)>);
175  return std::string(); // unreachable, but needed to avoid extra error messages
176  }
177 }
std::string to_string(char const *&&v)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: