diff --git a/CMakeLists.txt b/CMakeLists.txt index b45b0b3..d227c81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ target_link_libraries(boost_property_map Boost::function Boost::iterator Boost::lexical_cast - Boost::smart_ptr Boost::throw_exception Boost::type_traits Boost::utility diff --git a/build.jam b/build.jam index 33aa7e4..1dbea10 100644 --- a/build.jam +++ b/build.jam @@ -14,7 +14,6 @@ constant boost_dependencies : /boost/function//boost_function /boost/iterator//boost_iterator /boost/lexical_cast//boost_lexical_cast - /boost/smart_ptr//boost_smart_ptr /boost/throw_exception//boost_throw_exception /boost/type_index//boost_type_index /boost/type_traits//boost_type_traits diff --git a/include/boost/property_map/dynamic_property_map.hpp b/include/boost/property_map/dynamic_property_map.hpp index c81bc56..595d570 100644 --- a/include/boost/property_map/dynamic_property_map.hpp +++ b/include/boost/property_map/dynamic_property_map.hpp @@ -2,6 +2,7 @@ #define BOOST_PROPERTY_MAP_DYNAMIC_PROPERTY_MAP_HPP // Copyright 2004-5 The Trustees of Indiana University. +// Copyright 2026, Arnaud Becheler // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -26,9 +27,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -210,9 +211,9 @@ class dynamic_property_map_adaptor : public dynamic_property_map // struct dynamic_properties { - typedef std::multimap > + typedef std::multimap > property_maps_type; - typedef boost::function3, + typedef boost::function3, const std::string&, const boost::any&, const boost::any&> generate_fn_type; @@ -230,9 +231,9 @@ struct dynamic_properties dynamic_properties& property(const std::string& name, PropertyMap property_map_) { - boost::shared_ptr pm( - boost::static_pointer_cast( - boost::make_shared >(property_map_))); + std::shared_ptr pm( + std::static_pointer_cast( + std::make_shared >(property_map_))); property_maps.insert(property_maps_type::value_type(name, pm)); return *this; @@ -259,13 +260,13 @@ struct dynamic_properties { return property_maps.lower_bound(name); } void - insert(const std::string& name, boost::shared_ptr pm) + insert(const std::string& name, std::shared_ptr pm) { property_maps.insert(property_maps_type::value_type(name, pm)); } template - boost::shared_ptr + std::shared_ptr generate(const std::string& name, const Key& key, const Value& value) { if(!generate_fn) { @@ -293,7 +294,7 @@ put(const std::string& name, dynamic_properties& dp, const Key& key, } } - boost::shared_ptr new_map = dp.generate(name, key, value); + std::shared_ptr new_map = dp.generate(name, key, value); if (new_map.get()) { new_map->put(key, value); dp.insert(name, new_map); @@ -344,11 +345,11 @@ get(const std::string& name, const dynamic_properties& dp, const Key& key) // The easy way to ignore properties. inline -boost::shared_ptr +std::shared_ptr ignore_other_properties(const std::string&, const boost::any&, const boost::any&) { - return boost::shared_ptr(); + return std::shared_ptr(); } } // namespace boost diff --git a/include/boost/property_map/shared_array_property_map.hpp b/include/boost/property_map/shared_array_property_map.hpp index 8056d95..915faff 100644 --- a/include/boost/property_map/shared_array_property_map.hpp +++ b/include/boost/property_map/shared_array_property_map.hpp @@ -1,5 +1,6 @@ // Copyright (C) 2009 Trustees of Indiana University // Authors: Jeremiah Willcock, Andrew Lumsdaine +// Copyright 2026, Arnaud Becheler // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -10,8 +11,8 @@ #ifndef BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP #define BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP -#include #include +#include namespace boost { @@ -30,14 +31,14 @@ class shared_array_property_map explicit inline shared_array_property_map( size_t n, const IndexMap& _id = IndexMap()) - : data(new T[n]), index(_id) {} + : data(new T[n], std::default_delete()), index(_id) {} inline T& operator[](key_type v) const { - return data[get(index, v)]; + return data.get()[get(index, v)]; } private: - boost::shared_array data; + std::shared_ptr data; IndexMap index; }; diff --git a/include/boost/property_map/vector_property_map.hpp b/include/boost/property_map/vector_property_map.hpp index c24b5a7..733087e 100644 --- a/include/boost/property_map/vector_property_map.hpp +++ b/include/boost/property_map/vector_property_map.hpp @@ -1,4 +1,5 @@ // Copyright (C) Vladimir Prus 2003. +// Copyright 2026, Arnaud Becheler // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -11,9 +12,9 @@ #define BOOST_PROPERTY_MAP_VECTOR_PROPERTY_MAP_HPP #include -#include #include #include +#include #include namespace boost { @@ -32,12 +33,12 @@ namespace boost { typedef boost::lvalue_property_map_tag category; vector_property_map(const IndexMap& index = IndexMap()) - : store(new std::vector()), index(index) + : store(std::make_shared >()), index(index) {} vector_property_map(std::size_t initial_size, const IndexMap& index = IndexMap()) - : store(new std::vector(initial_size)), index(index) + : store(std::make_shared >(initial_size)), index(index) {} typename std::vector::iterator storage_begin() @@ -82,7 +83,7 @@ namespace boost { // store pointer to data, because if copy of property map resizes // the vector, the pointer to data will be invalidated. // I wonder if class 'pmap_ref' is simply needed. - shared_ptr< std::vector > store; + std::shared_ptr< std::vector > store; IndexMap index; }; diff --git a/test/dynamic_properties_test.cpp b/test/dynamic_properties_test.cpp index 779d31a..da5520c 100644 --- a/test/dynamic_properties_test.cpp +++ b/test/dynamic_properties_test.cpp @@ -1,5 +1,6 @@ // Copyright 2005 The Trustees of Indiana University. +// Copyright 2026, Arnaud Becheler // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -18,17 +19,15 @@ #endif #include -#include #include #include #include -#include #include #include // generate a dynamic_property_map that maps strings to strings // WARNING: This code uses library internals. For testing purposes only! -boost::shared_ptr +std::shared_ptr string2string_gen(const std::string&, const boost::any&, const boost::any&) { @@ -41,7 +40,7 @@ string2string_gen(const std::string&, std::shared_ptr mymap = std::make_shared(); adaptor_t* adaptor = new adaptor_t(property_t(*mymap)); - return boost::shared_ptr( + return std::shared_ptr( adaptor, [mymap](boost::dynamic_property_map* p) { delete p; }); }