[property_tree] Primitive types for data not supported?

I just noticed that Boost.PropertyTree doesn't support primitive types for data (Boost 1.47.0). For example, this doesn't compile: boost::property_tree::basic_ptree<std::string, int> pt, pt2; pt.swap(pt2); The reason is this code in <http://svn.boost.org/svn/boost/trunk/boost/property_tree/detail/ptree_implementation.hpp>: template<class K, class D, class C> inline 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); } Primitive types like int obviously don't have a member function swap(). Is this an oversight or are primitive types intentionally not supported? Boris

On 25.09.2011 18:18, Boris Schaeling wrote:
I just noticed that Boost.PropertyTree doesn't support primitive types for data (Boost 1.47.0). For example, this doesn't compile:
boost::property_tree::basic_ptree<std::string, int> pt, pt2; pt.swap(pt2);
The reason is this code in <http://svn.boost.org/svn/boost/trunk/boost/property_tree/detail/ptree_implementation.hpp>:
template<class K, class D, class C> inline 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); }
Primitive types like int obviously don't have a member function swap(). Is this an oversight or are primitive types intentionally not supported? It's an oversight. Can you please file a bug?
Sebastian

On Sun, 25 Sep 2011 19:40:01 +0200, Sebastian Redl <sebastian.redl@getdesigned.at> wrote:
On 25.09.2011 18:18, Boris Schaeling wrote:
I just noticed that Boost.PropertyTree doesn't support primitive types for data (Boost 1.47.0). For example, this doesn't compile:
boost::property_tree::basic_ptree<std::string, int> pt, pt2; pt.swap(pt2);
The reason is this code in <http://svn.boost.org/svn/boost/trunk/boost/property_tree/detail/ptree_implementation.hpp>:
template<class K, class D, class C> inline 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); }
Primitive types like int obviously don't have a member function swap(). Is this an oversight or are primitive types intentionally not supported?
It's an oversight. Can you please file a bug?
Ok, done: <https://svn.boost.org/trac/boost/ticket/5944> Boris
participants (2)
-
Boris Schaeling
-
Sebastian Redl