OmniSciDB  bf83d84833
 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 129 of file StringTransform.h.

References to_string().

Referenced by concat(), and concat_with().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: