Boost C++ Libraries: Ticket #3982: mpl::at documentation out of sync with code https://svn.boost.org/trac10/ticket/3982 <p> Documentation of mpl::at indicates that it can take either 2 or 3 template parameters, but in fact only takes just 2. The documentation indicates a third template parameter to forward a default if lookup fails to find a match. This option does not exist. </p> <p> Code or Documentation should be amended. If there will be no 3 template parameter option, the following would be nice to have in the documentation, as how to achieve a default when no match is found: </p> <p> typename boost::mpl::eval_if&lt; </p> <blockquote> <p> typename boost::mpl::has_key&lt; Map, Key &gt;::type </p> </blockquote> <blockquote> <p> , boost::mpl::at&lt; Map, Key &gt; , boost::mpl::identity&lt; Default &gt; </p> <blockquote class="citation"> <p> ::type </p> </blockquote> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3982 Trac 1.4.3 Steven Watanabe Tue, 09 Mar 2010 08:08:14 GMT component changed https://svn.boost.org/trac10/ticket/3982#comment:1 https://svn.boost.org/trac10/ticket/3982#comment:1 <ul> <li><strong>component</strong> <span class="trac-field-old">Documentation</span> → <span class="trac-field-new">mpl</span> </li> </ul> Ticket dsaritz@… Mon, 17 May 2010 09:33:43 GMT <link>https://svn.boost.org/trac10/ticket/3982#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:2</guid> <description> <p> In my experience (with MSVC++) implementing the defaulted at as </p> <p> ... </p> <p> { </p> <blockquote> <p> typedef typename boost::mpl::at&lt;Seq, Key&gt;::type in_seq; </p> </blockquote> <blockquote> <p> typedef typename boost::mpl::if_ </p> <blockquote> <p> &lt; </p> <blockquote> <p> boost::is_same&lt;in_seq, boost::mpl::void_&gt;, Default, in_seq </p> <blockquote class="citation"> <p> ::type type; </p> </blockquote> </blockquote> </blockquote> </blockquote> <p> } </p> <p> or by using find + compare-to-end (instead of void) + deref proved to be more (compile-time) efficient (probably because of skipping the instantiation of has_key&lt;&gt;...)... </p> <p> In any case, the defaulted at should IMO be provided out-of-the-box by MPL (both because of 'cleanness' and because the library author has the best chance to make it as efficient as possible)... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 05 Jun 2010 20:39:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3982#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:3</guid> <description> <p> Having a three argument at in the library is not necessarily more efficient overall, since it will increase the overhead of the two-argument at. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gordon Woodhull</dc:creator> <pubDate>Sun, 02 Jan 2011 05:27:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3982#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:4</guid> <description> <p> Steven, are you saying that it should probably have a different name for efficiency reasons? </p> <p> at_def? at_or? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>jeffrey.hellrung</dc:creator> <pubDate>Tue, 12 Jun 2012 17:46:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3982#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:5</guid> <description> <p> So what's the correct resolution here? Update the documentation to remove the 3-argument version? Or implement the 3rd argument? Seems like the former is easier/safer. I'd be willing to do either to the best of my abilities. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Aleksey Gurtovoy</dc:creator> <pubDate>Tue, 12 Jun 2012 22:33:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3982#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:6</guid> <description> <p> The correct resolution would be to add the default argument support. I'd be happy to review your patch. </p> </description> <category>Ticket</category> </item> <item> <author>wmamrak@…</author> <pubDate>Fri, 10 Jan 2014 13:35:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3982#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:7</guid> <description> <p> Anyone still interested in fixing this? Why does it take so long? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 07 Mar 2016 19:26:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3982#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3982#comment:8</guid> <description> <p> Damn... I've just wasted like 10 hours trying to feed it default value. And I'm complete newbie in C++ and it's templates. Please, please, fix it.. :) </p> </description> <category>Ticket</category> </item> </channel> </rss>