1 #ifndef CONVERSION_UTILITIES_WIDEN_H 2 #define CONVERSION_UTILITIES_WIDEN_H 18 template <
class E,
class T = std::
char_traits<E>,
class A = std::allocator<E>>
24 Widen(
const std::locale &locale = std::locale())
26 , m_pctype(&std::use_facet<std::ctype<E>>(locale))
36 std::basic_string<E, T, A>
operator()(
const std::string &
string)
const 38 typename std::basic_string<E, T, A>::size_type srcLen =
string.length();
39 const char *srcBeg =
string.c_str();
40 std::vector<E> tmp(srcLen);
41 m_pctype->widen(srcBeg, srcBeg + srcLen, &tmp[0]);
42 return std::basic_string<E, T, A>(&tmp[0], srcLen);
47 const std::ctype<E> *m_pctype;
51 #endif // CONVERSION_UTILITIES_WIDEN_H #define CPP_UTILITIES_EXPORT
std::basic_string< E, T, A > operator()(const std::string &string) const
Performs the conversation for the provided string.
Converts a std::string to a wide string using the specified locale.
Contains several functions providing conversions between different data types.
Widen(const std::locale &locale=std::locale())
Constructs a new instance with the specified locale.