OmniSciDB  c1a53651b2
 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 142 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: