tnintemann / rpms / boost

Forked from rpms/boost 3 years ago
Clone
Blob Blame History Raw
diff -up boost_1_53_0/boost/lexical_cast.hpp\~ boost_1_53_0/boost/lexical_cast.hpp
--- /boost_1_53_0/boost/lexical_cast.hpp~	2014-09-15 15:36:36.915684568 +0200
+++ /boost_1_53_0/boost/lexical_cast.hpp	2014-09-15 15:43:54.086756641 +0200
@@ -2404,16 +2404,57 @@ namespace boost {
         return caster_type::lexical_cast_impl(arg);
     }
 
-    template <typename Target, typename CharType>
-    inline Target lexical_cast(const CharType* chars, std::size_t count)
+    template <typename Target>
+    inline Target lexical_cast(const char* chars, std::size_t count)
+     {
+        return ::boost::lexical_cast<Target>(
+            ::boost::iterator_range<const char*>(chars, chars + count)
+        );
+    }
+
+    template <typename Target>
+    inline Target lexical_cast(const unsigned char* chars, std::size_t count)
     {
-        BOOST_STATIC_ASSERT_MSG(boost::detail::is_char_or_wchar<CharType>::value, 
-            "CharType must be a character or wide character type");
+         return ::boost::lexical_cast<Target>(
+            ::boost::iterator_range<const unsigned char*>(chars, chars + count)
+         );
+     }
 
-        return boost::lexical_cast<Target>(
-            boost::iterator_range<const CharType*>(chars, chars + count)
+    template <typename Target>
+    inline Target lexical_cast(const signed char* chars, std::size_t count)
+    {
+        return ::boost::lexical_cast<Target>(
+            ::boost::iterator_range<const signed char*>(chars, chars + count)
+        );
+    }
+
+#ifndef BOOST_LCAST_NO_WCHAR_T
+    template <typename Target>
+    inline Target lexical_cast(const wchar_t* chars, std::size_t count)
+    {
+        return ::boost::lexical_cast<Target>(
+            ::boost::iterator_range<const wchar_t*>(chars, chars + count)
         );
     }
+#endif
+#ifndef BOOST_NO_CHAR16_T
+    template <typename Target>
+    inline Target lexical_cast(const char16_t* chars, std::size_t count)
+    {
+        return ::boost::lexical_cast<Target>(
+            ::boost::iterator_range<const char16_t*>(chars, chars + count)
+        );
+    }
+#endif
+#ifndef BOOST_NO_CHAR32_T
+    template <typename Target>
+    inline Target lexical_cast(const char32_t* chars, std::size_t count)
+    {
+        return ::boost::lexical_cast<Target>(
+            ::boost::iterator_range<const char32_t*>(chars, chars + count)
+        );
+    }
+#endif
 
 } // namespace boost