24 #ifdef LEXICAL_CAST_DEBUG
25 #undef LEXICAL_CAST_HPP_INCLUDED
28 #ifndef LEXICAL_CAST_HPP_INCLUDED
29 #define LEXICAL_CAST_HPP_INCLUDED
31 #ifdef LEXICAL_CAST_DEBUG
41 #define DEBUG_THROW(id) throw id;
45 #define __LONG_LONG_SUPPORTED
49 #define strtoll _strtoi64
50 #define strtoull _strtoui64
58 #include <boost/mpl/set.hpp>
59 #include <boost/type_traits.hpp>
60 #include <boost/utility/enable_if.hpp>
62 #define DEBUG_THROW(id)
75 ,
typename ToEnable =
void
76 ,
typename FromEnable =
void
92 template<
typename To,
typename From>
118 ,
typename FromEnable
127 std::stringstream sstr;
129 if(!(sstr << value && sstr >> result)) {
143 template <
typename From>
148 , typename boost::enable_if<boost::is_integral<
149 typename boost::remove_pointer<From>::type> >
::type
154 DEBUG_THROW(
"specialized - To std::string - From integral (pointer)");
156 std::stringstream sstr;
169 template <
class From>
174 , typename
boost::enable_if<boost::mpl::has_key<boost::mpl::set<
175 char*, const char*> , From> >
::type
180 DEBUG_THROW(
"specialized - To long long - From (const) char*");
183 int res = strtoll(value, &endptr, 10);
185 if (*value ==
'\0' || *endptr !=
'\0') {
208 DEBUG_THROW(
"specialized - To long long - From std::string");
219 template <
class To,
class From>
223 , typename
boost::enable_if<boost::is_signed<To> >
::type
224 , typename boost::enable_if<boost::mpl::has_key<boost::mpl::set<
225 char*, const char*> , From> >
::type
230 DEBUG_THROW(
"specialized - To signed - From (const) char*");
233 int res = strtol(value, &endptr, 10);
235 if (*value ==
'\0' || *endptr !=
'\0') {
252 , typename boost::enable_if<boost::is_signed<To> >
::type
257 DEBUG_THROW(
"specialized - To signed - From std::string");
270 template <
class From>
275 , typename
boost::enable_if<boost::mpl::has_key<boost::mpl::set<
276 char*, const char*> , From> >
::type
282 "specialized - To unsigned long long - From (const) char*");
285 int res = strtoull(value, &endptr, 10);
287 if (*value ==
'\0' || *endptr !=
'\0') {
310 DEBUG_THROW(
"specialized - To unsigned long long - From std::string");
321 template <
class To,
class From>
325 , typename
boost::enable_if<boost::is_unsigned<To> >
::type
326 , typename boost::enable_if<boost::mpl::has_key<boost::mpl::set<
327 char*, const char*> , From> >
::type
332 DEBUG_THROW(
"specialized - To unsigned - From (const) char*");
335 int res = strtoul(value, &endptr, 10);
337 if (*value ==
'\0' || *endptr !=
'\0') {
354 , typename boost::enable_if<boost::is_unsigned<To> >
::type
359 DEBUG_THROW(
"specialized - To unsigned - From std::string");
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
long long operator()(From value)
GLuint GLuint GLsizei GLenum type
Base class for the conversion.
#define DEBUG_THROW(id)
Throws an exception for debugging.
To operator()(From value)
To lexical_cast(From value)
Lexical cast converts one type to another.
GLsizei const GLfloat * value
long long operator()(const std::string &value)
To operator()(From value)
To operator()(const std::string &value)
std::string operator()(From value)
long long operator()(From value)
To operator()(From value)
To operator()(const std::string &value)
long long operator()(const std::string &value)
Thrown when a lexical_cast fails.
GLsizei const GLcharARB ** string
Contains the implementation details for lexical_cast and shouldn't be used directly.