specializing boost::lexical_cast for enums in boost::property_maps
<p>I am trying to use a <code>boost::graph</code> that has an <code>enum</code> inside its bundled vertex property. The problem starts when I try to use the bundled property for a boost::dynamic_property. Looks like I can't get the correct template specialization for boost::lexical_cast to recognize the type.</p>

<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;boost/lexical_cast.hpp&gt;
#include &lt;boost/graph/adjacency_list.hpp&gt;
#include &lt;boost/property_map/dynamic_property_map.hpp&gt;

enum MyEnum { A, B, C };

namespace boost{
    template&lt;&gt;
    std::string lexical_cast(const MyEnum &amp; m)
    {
        return std::to_string(int(m));
    }
} /* boost */

struct EnumWrapper
{
    MyEnum e;

    EnumWrapper() = default;
    EnumWrapper(MyEnum e) : e{e}
    {}
};

int main()
{
    using namespace boost;

    // This works
    MyEnum e{MyEnum::B};
    std::cout &lt;&lt; lexical_cast&lt;std::string&gt;(e) &lt;&lt; std::endl;

    // This doesn't compile
    adjacency_list&lt;vecS, vecS, directedS, EnumWrapper&gt; graph;
    dynamic_properties dp;
    dp.property("test", get(&amp;EnumWrapper::e, graph));

    return 0;
}
</code></pre>

<p>If I try writing the <code>enum</code> directly, everything works fine. When try to put it in the dynamic property, the following error appears:</p>

<pre><code>In file included from /usr/include/boost/iterator/iterator_categories.hpp:22:0,
                 from /usr/include/boost/iterator/iterator_facade.hpp:14,
                 from /usr/include/boost/range/iterator_range_core.hpp:27,
                 from /usr/include/boost/lexical_cast.hpp:30,
                 from main.cpp:3:
/usr/include/boost/lexical_cast/detail/converter_lexical.hpp: In instantiation of ‘struct boost::detail::deduce_target_char_impl&lt;boost::detail::deduce_character_type_later&lt;MyEnum&gt; &gt;’:
/usr/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:   required from ‘struct boost::detail::deduce_target_char&lt;MyEnum&gt;’
/usr/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:   required from ‘struct boost::detail::lexical_cast_stream_traits&lt;std::__cxx11::basic_string&lt;char&gt;, MyEnum&gt;’
/usr/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:   required from ‘struct boost::detail::lexical_converter_impl&lt;MyEnum, std::__cxx11::basic_string&lt;char&gt; &gt;’
/usr/include/boost/lexical_cast/try_lexical_convert.hpp:181:44:   required from ‘bool boost::conversion::detail::try_lexical_convert(const Source&amp;, Target&amp;) [with Target = MyEnum; Source = std::__cxx11::basic_string&lt;char&gt;]’
/usr/include/boost/lexical_cast.hpp:41:60:   required from ‘Target boost::lexical_cast(const Source&amp;) [with Target = MyEnum; Source = std::__cxx11::basic_string&lt;char&gt;]’
/usr/include/boost/property_map/dynamic_property_map.hpp:44:38:   required from ‘Value boost::detail::read_value(const string&amp;) [with Value = MyEnum; std::__cxx11::string = std::__cxx11::basic_string&lt;char&gt;]’
/usr/include/boost/property_map/dynamic_property_map.hpp:158:64:   required from ‘void boost::detail::dynamic_property_map_adaptor&lt;PropertyMap&gt;::do_put(const boost::any&amp;, const boost::any&amp;, mpl_::bool_&lt;true&gt;) [with PropertyMap = boost::vec_adj_list_vertex_property_map&lt;boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::directedS, EnumWrapper&gt;, boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::directedS, EnumWrapper&gt;*, MyEnum, MyEnum&amp;, MyEnum EnumWrapper::*&gt;]’
/usr/include/boost/property_map/dynamic_property_map.hpp:186:11:   required from ‘void boost::detail::dynamic_property_map_adaptor&lt;PropertyMap&gt;::put(const boost::any&amp;, const boost::any&amp;) [with PropertyMap = boost::vec_adj_list_vertex_property_map&lt;boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::directedS, EnumWrapper&gt;, boost::adjacency_list&lt;boost::vecS, boost::vecS, boost::directedS, EnumWrapper&gt;*, MyEnum, MyEnum&amp;, MyEnum EnumWrapper::*&gt;]’
main.cpp:40:1:   required from here
/usr/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13: error: static assertion failed: Target type is neither std::istream`able nor std::wistream`able
             BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift&lt;std::basic_istream&lt;wchar_t&gt;, T &gt;::value),
</code></pre>

<p>The line <code>Target type is neither std::istreamable nor std::wistreamable</code> suggests to me, that the lexical_cast is not specialized correctly. However, using the lexical cast directly appears to work just fine.</p>