Opened 12 months ago

#13327 new Bugs

Issue with boost::property_tree::ptree inside lambda with a capture using Visual Studio 2017

Reported by: shubham.srivastava@… Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc:


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.

I get the following errors from line 4 and line 6 when compiling the attached file.

boost\include\boost-1_56\boost\property_tree\detail\ptree_implementation.hpp(252): error C2440: '<function-style-cast>': cannot convert from 'boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::sequenced_index_node<Super>>' to 'boost::property_tree::basic_ptree<std::string,std::string,std::less<Key>>::const_iterator'

with [

Super=boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<std::pair<const std::string,boost::property_tree::basic_ptree<std::string,std::string,std::less<std::string>>>,std::allocator<std::pair<const std::string,boost::property_tree::basic_ptree<std::string,std::string,std::less<std::string>>>>>>

] and [



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

note: see reference to function template instantiation 'boost::property_tree::basic_ptree<std::string,std::string,std::less<Key>>::const_iterator boost::property_tree::basic_ptree<Key,std::string,std::less<Key>>::begin(void) const' being compiled

with [



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.

Attachments (1)

test_ptree.cpp (185 bytes) - added by anonymous 12 months ago.
Source file to reproduce the issue

Download all attachments as: .zip

Change History (1)

Changed 12 months ago by anonymous

Attachment: test_ptree.cpp added

Source file to reproduce the issue

Note: See TracTickets for help on using tickets.