Boost C++ Libraries: Ticket #13327: Issue with boost::property_tree::ptree inside lambda with a capture using Visual Studio 2017 https://svn.boost.org/trac10/ticket/13327 <p> We are running into an issue with Boost 1.56.0, in boost::property_tree:: ptree, when using it inside lambda function with a capture using Visual Studio 2017. </p> <p> I get the following errors from line 4 and line 6 when compiling the attached file. </p> <p> boost\include\boost-1_56\boost\property_tree\detail\ptree_implementation.hpp(252): error C2440: '&lt;function-style-cast&gt;': cannot convert from 'boost::multi_index::detail::bidir_node_iterator&lt;boost::multi_index::detail::sequenced_index_node&lt;Super&gt;&gt;' to 'boost::property_tree::basic_ptree&lt;std::string,std::string,std::less&lt;Key&gt;&gt;::const_iterator' </p> <blockquote> <p> with [ </p> <blockquote> <p> Super=boost::multi_index::detail::ordered_index_node&lt;boost::multi_index::detail::index_node_base&lt;std::pair&lt;const std::string,boost::property_tree::basic_ptree&lt;std::string,std::string,std::less&lt;std::string&gt;&gt;&gt;,std::allocator&lt;std::pair&lt;const std::string,boost::property_tree::basic_ptree&lt;std::string,std::string,std::less&lt;std::string&gt;&gt;&gt;&gt;&gt;&gt; </p> </blockquote> <p> ] and [ </p> <blockquote> <p> Key=std::string </p> </blockquote> <p> ] </p> </blockquote> <p> boost\include\boost-1_56\boost\property_tree\detail\ptree_implementation.hpp(252): note: No constructor could take the source type, or constructor overload resolution was ambiguous </p> <p> note: see reference to function template instantiation 'boost::property_tree::basic_ptree&lt;std::string,std::string,std::less&lt;Key&gt;&gt;::const_iterator boost::property_tree::basic_ptree&lt;Key,std::string,std::less&lt;Key&gt;&gt;::begin(void) const' being compiled </p> <blockquote> <p> with [ </p> <blockquote> <p> Key=std::string </p> </blockquote> <p> ] </p> </blockquote> <p> The workaround that we have is to use auto instead of the actual types for the const_iterator returned from begin(). See attached cpp file. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13327 Trac 1.4.3 anonymous Wed, 06 Dec 2017 10:14:50 GMT attachment set https://svn.boost.org/trac10/ticket/13327 https://svn.boost.org/trac10/ticket/13327 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_ptree.cpp</span> </li> </ul> <p> Source file to reproduce the issue </p> Ticket