Modify

Opened 6 years ago

Closed 6 years ago

#5944 closed Bugs (fixed)

Compiler error when primitive type for data used

Reported by: bschaeling Owned by: Sebastian Redl
Milestone: Boost 1.48.0 Component: property_tree
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

This doesn't compile because the primitive type int is used as a second template parameter:

boost::property_tree::basic_ptree<std::string, int> pt, pt2;
pt.swap(pt2);

The reason is this code in version 1.47.0 of <http://svn.boost.org/svn/boost/trunk/boost/property_tree/detail/ptree_implementation.hpp>:

void basic_ptree<K, D, C>::swap(basic_ptree<K, D, C> &rhs)
{
  m_data.swap(rhs.m_data);
  // Void pointers, no ADL necessary
  std::swap(m_children, rhs.m_children);
}

m_data.swap() should be replaced with std::swap() or boost::swap() to make it possible to use primitive types for data.

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by Sebastian Redl

(In [74691]) Use boost::swap for swapping PTree's data member. Makes it possible to use types as data that don't provide a member swap(). See bug 5944.

comment:2 Changed 6 years ago by Sebastian Redl

Resolution: fixed
Status: newclosed

(In [76447]) Merge [72000],[72001],[72003], [74691], [75587], [75589], [75590], and [75593] from trunk. Fixes bug 4840. Fixes bug 5259. Fixes bug 5281, I think. Fixes bug 5944. Fixes bug 5757. Fixes bug 5710. Fixes bug 5307, I think.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Sebastian Redl.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.