OmniSciDB  471d68cefb
 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 146 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: