Boost C++ Libraries: Ticket #6091: Not documented requirement about I/O operators https://svn.boost.org/trac10/ticket/6091 <p> The Fusion documentation in Boost 1.47 does not mention that in order to make Fusion-adapted types usable with input and output operators, it is necessary to import these operators into type's namespace. </p> <p> The problem is discussed in the thread <a class="ext-link" href="http://lists.boost.org/boost-users/2011/11/71518.php"><span class="icon">​</span>Adapted struct I/O</a>. </p> <p> Here is sample based on the <a href="http://www.boost.org/doc/libs/1_47_0/libs/fusion/doc/html/fusion/adapted/adapt_tpl_struct.html">demo::employee</a> example that shows correct use of Fusion-adapted type: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;boost/fusion/adapted/struct/adapt_struct.hpp&gt; #include &lt;boost/fusion/include/adapt_struct.hpp&gt; #include &lt;boost/fusion/sequence/io.hpp&gt; #include &lt;boost/fusion/include/io.hpp&gt; namespace demo { // This does the trick, but not documented using boost::fusion::operators::operator&lt;&lt;; using boost::fusion::operators::operator&gt;&gt;; template&lt;typename Name, typename Age&gt; struct employee { Name name; Age age; }; } // Any instantiated demo::employee is now a Fusion sequence BOOST_FUSION_ADAPT_TPL_STRUCT( (Name)(Age), (demo::employee) (Name)(Age), (Name, name) (Age, age)) int main() { demo::employee&lt;std::string, int&gt; e; std::cin &gt;&gt; e; std::cout &lt;&lt; e &lt;&lt; std::endl; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6091 Trac 1.4.3 anonymous Tue, 08 Nov 2011 16:04:43 GMT component changed; owner set https://svn.boost.org/trac10/ticket/6091#comment:1 https://svn.boost.org/trac10/ticket/6091#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Joel de Guzman</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fusion</span> </li> </ul> Ticket Joel de Guzman Wed, 09 Nov 2011 00:39:16 GMT <link>https://svn.boost.org/trac10/ticket/6091#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6091#comment:2</guid> <description> <p> Would you care to submit a patch? :-) I'd be happy to apply one, if you do. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Wed, 09 Nov 2011 19:55:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6091#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6091#comment:3</guid> <description> <p> I would care but I can not do it. I have clearly no idea where this should be added. IO chapter, Sequences chapter, near the demo example...does it apply to all sequences, are there any exceptions to this friend-ship rule, etc. I'm lacking of Fusion fu. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 09 Nov 2011 23:39:41 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6091#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6091#comment:4</guid> <description> <p> The thing is, this is more a C++ issue than it is a Fusion issue. It's about how ADL cannot happen if the types are in different namespaces. Perhaps a quick note somewhere in the demo is all that's needed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Thu, 05 Jul 2018 13:59:05 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/6091#comment:5 https://svn.boost.org/trac10/ticket/6091#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.68.0</span> </li> </ul> <p> <a class="ext-link" href="https://github.com/boostorg/fusion/pull/185"><span class="icon">​</span>https://github.com/boostorg/fusion/pull/185</a> </p> Ticket