+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ // call-by-const reference version
+
+ namespace detail
+ {
+ template<class T>
+ struct array_to_pointer_decay
+ {
+ typedef T type;
+ };
+
+ template<class T, std::size_t N>
+ struct array_to_pointer_decay<T[N]>
+ {
+ typedef const T * type;
+ };
+ }
+
+ template<typename Target, typename Source>
+ Target lexical_cast(const Source &arg)
+ {
+ typedef typename detail::array_to_pointer_decay<Source>::type NewSource;
+
+ detail::lexical_stream<Target, NewSource> interpreter;
+ Target result;
+
+ if(!(interpreter << arg && interpreter >> result))
+ throw_exception(bad_lexical_cast(typeid(NewSource), typeid(Target)));
+ return result;
+ }
+
+ #else
+
+ // call-by-value fallback version (deprecated)
+