OmniSciDB  085a039ca4
 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 139 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: