Boost C++ Libraries: Ticket #8989: asio::ip namespace issues, and proposed solution https://svn.boost.org/trac10/ticket/8989 <p> Given an <a href="http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/InternetProtocol.html">InternetProtocol</a> (usually <a href="http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ip__tcp.html">ip::tcp</a>), there's no generic way to get access to these classes: </p> <pre class="wiki">class boost::asio::ip::address_v4; class boost::asio::ip::address_v6; </pre><p> The reason is that boost::tcp::ip is a namespace and not a type. </p> <p> I propose adding these to the requirements for <a href="http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/InternetProtocol.html">InternetProtocol</a>: </p> <pre class="wiki">X::address_v4, return type boost::asio::ip::address_v4 X::address_v6, return type boost::asio::ip::address_v6 </pre><p> This would enable template classes parameterized on <a href="http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/InternetProtocol.html">InternetProtocol</a> to be able to choose an address type. For example: </p> <pre class="wiki">template &lt;typename InternetProtcol&gt; struct Details { typedef InternetProtocol protocol_type; typedef protocol_type::endpoint endpoint_type; // Good, with this proposal typedef protocol_type::address_v4 address_v4; endpoint_type get_endpoint () { return endpoint_type (address_v4::any (), 1053); } // Bad, the only current solution typedef boost::asio::ip::address_v4 address_v4; endpoint_type get_endpoint_bad () { return endpoint_type (address_v4::any (), 1053); } }; </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8989 Trac 1.4.3 viboes Sat, 10 Aug 2013 07:24:49 GMT component changed; owner set https://svn.boost.org/trac10/ticket/8989#comment:1 https://svn.boost.org/trac10/ticket/8989#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">asio</span> </li> </ul> Ticket