templates - C++ type_traits for is static variable -
is there way in c++11 know if "const static" variable or no?
linked question
need modify function:
template<typename t> std::string to_string1(const t& value) { std::ostringstream oss; oss << value; return oss.str(); }
live demo http://coliru.stacked-crooked.com/a/ef91dff7d99aab29
if have "const int" variable compiler "undefined reference".
avoid want modify function (without & case):
template <typename t> std::stringtost( typename std::conditional< std::is_static<t>::value , const t, const t& >::type std::ostringstream oss; oss << value; return oss.str(); ){
so i'll have 2 functions - 1 static const (with t value parameter), ant second other (with t& parameter)
Comments
Post a Comment