Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 12 additions & 11 deletions include/boost/property_map/dynamic_property_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,9 +27,9 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type.hpp>
#include <boost/type_index.hpp>
#include <boost/smart_ptr.hpp>
#include <exception>
#include <map>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -210,9 +211,9 @@ class dynamic_property_map_adaptor : public dynamic_property_map
//
struct dynamic_properties
{
typedef std::multimap<std::string, boost::shared_ptr<dynamic_property_map> >
typedef std::multimap<std::string, std::shared_ptr<dynamic_property_map> >
property_maps_type;
typedef boost::function3<boost::shared_ptr<dynamic_property_map>,
typedef boost::function3<std::shared_ptr<dynamic_property_map>,
const std::string&,
const boost::any&,
const boost::any&> generate_fn_type;
Expand All @@ -230,9 +231,9 @@ struct dynamic_properties
dynamic_properties&
property(const std::string& name, PropertyMap property_map_)
{
boost::shared_ptr<dynamic_property_map> pm(
boost::static_pointer_cast<dynamic_property_map>(
boost::make_shared<detail::dynamic_property_map_adaptor<PropertyMap> >(property_map_)));
std::shared_ptr<dynamic_property_map> pm(
std::static_pointer_cast<dynamic_property_map>(
std::make_shared<detail::dynamic_property_map_adaptor<PropertyMap> >(property_map_)));
property_maps.insert(property_maps_type::value_type(name, pm));

return *this;
Expand All @@ -259,13 +260,13 @@ struct dynamic_properties
{ return property_maps.lower_bound(name); }

void
insert(const std::string& name, boost::shared_ptr<dynamic_property_map> pm)
insert(const std::string& name, std::shared_ptr<dynamic_property_map> pm)
{
property_maps.insert(property_maps_type::value_type(name, pm));
}

template<typename Key, typename Value>
boost::shared_ptr<dynamic_property_map>
std::shared_ptr<dynamic_property_map>
generate(const std::string& name, const Key& key, const Value& value)
{
if(!generate_fn) {
Expand Down Expand Up @@ -293,7 +294,7 @@ put(const std::string& name, dynamic_properties& dp, const Key& key,
}
}

boost::shared_ptr<dynamic_property_map> new_map = dp.generate(name, key, value);
std::shared_ptr<dynamic_property_map> new_map = dp.generate(name, key, value);
if (new_map.get()) {
new_map->put(key, value);
dp.insert(name, new_map);
Expand Down Expand Up @@ -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<boost::dynamic_property_map>
std::shared_ptr<boost::dynamic_property_map>
ignore_other_properties(const std::string&,
const boost::any&,
const boost::any&) {
return boost::shared_ptr<boost::dynamic_property_map>();
return std::shared_ptr<boost::dynamic_property_map>();
}

} // namespace boost
Expand Down
9 changes: 5 additions & 4 deletions include/boost/property_map/shared_array_property_map.hpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -10,8 +11,8 @@
#ifndef BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP
#define BOOST_SHARED_ARRAY_PROPERTY_MAP_HPP

#include <boost/smart_ptr/shared_array.hpp>
#include <boost/property_map/property_map.hpp>
#include <memory>

namespace boost {

Expand All @@ -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<T[]>()), index(_id) {}

inline T& operator[](key_type v) const {
return data[get(index, v)];
return data.get()[get(index, v)];
}

private:
boost::shared_array<T> data;
std::shared_ptr<T> data;
IndexMap index;
};

Expand Down
9 changes: 5 additions & 4 deletions include/boost/property_map/vector_property_map.hpp
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -11,9 +12,9 @@
#define BOOST_PROPERTY_MAP_VECTOR_PROPERTY_MAP_HPP

#include <boost/property_map/property_map.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <cstddef>
#include <iterator>
#include <memory>
#include <vector>

namespace boost {
Expand All @@ -32,12 +33,12 @@ namespace boost {
typedef boost::lvalue_property_map_tag category;

vector_property_map(const IndexMap& index = IndexMap())
: store(new std::vector<T>()), index(index)
: store(std::make_shared<std::vector<T> >()), index(index)
{}

vector_property_map(std::size_t initial_size,
const IndexMap& index = IndexMap())
: store(new std::vector<T>(initial_size)), index(index)
: store(std::make_shared<std::vector<T> >(initial_size)), index(index)
{}

typename std::vector<T>::iterator storage_begin()
Expand Down Expand Up @@ -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<T> > store;
std::shared_ptr< std::vector<T> > store;
IndexMap index;
};

Expand Down
7 changes: 3 additions & 4 deletions test/dynamic_properties_test.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,17 +19,15 @@
#endif

#include <boost/core/lightweight_test.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/property_map/property_map.hpp>
#include <map>
#include <iostream>
#include <string>
#include <memory>

// generate a dynamic_property_map that maps strings to strings
// WARNING: This code uses library internals. For testing purposes only!
boost::shared_ptr<boost::dynamic_property_map>
std::shared_ptr<boost::dynamic_property_map>
string2string_gen(const std::string&,
const boost::any&,
const boost::any&) {
Expand All @@ -41,7 +40,7 @@ string2string_gen(const std::string&,
std::shared_ptr<map_t> mymap = std::make_shared<map_t>();
adaptor_t* adaptor = new adaptor_t(property_t(*mymap));

return boost::shared_ptr<boost::dynamic_property_map>(
return std::shared_ptr<boost::dynamic_property_map>(
adaptor, [mymap](boost::dynamic_property_map* p) { delete p; });
}

Expand Down
Loading