        template< typename Target
                , typename Source
                , bool Unlimited // string representation of Source is unlimited
                , typename CharT
                >
        struct lexical_cast
        {
            typedef BOOST_DEDUCED_TYPENAME
                deduce_char_traits<CharT,Target,Source>::type traits;

            typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
                lcast_streambuf_for_target<Target>::value ||
                lcast_streambuf_for_source<Source>::value
              , std::basic_streambuf<CharT>
              , lexical_streambuf_fake
              >::type base;

			Target operator()(BOOST_DEDUCED_TYPENAME boost::call_traits<Source>::param_type arg,
            CharT* buf, std::size_t src_len)
            {
				BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
					Unlimited
				  , detail::lexical_stream<Target,Source,traits>
				  , detail::lexical_stream_limited_src<CharT,base,traits>
				  >::type interpreter(buf, buf + src_len);
            
				if(interpreter << arg) {
					Target result;
					if (interpreter >> result)
						return result;
				}
				throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
				return Target(); // normally never reached (throw_exception)
            }
        };