diff options
Diffstat (limited to 'boost/archive/detail/helper_collection.hpp')
-rw-r--r-- | boost/archive/detail/helper_collection.hpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/boost/archive/detail/helper_collection.hpp b/boost/archive/detail/helper_collection.hpp index c01656777d..cfa644f7d4 100644 --- a/boost/archive/detail/helper_collection.hpp +++ b/boost/archive/detail/helper_collection.hpp @@ -24,10 +24,8 @@ #include <boost/config.hpp> -#ifdef BOOST_NO_CXX11_SMART_PTR - #include <boost/smart_ptr/shared_ptr.hpp> - #include <boost/smart_ptr/make_shared.hpp> -#endif +#include <boost/smart_ptr/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp> namespace boost { @@ -42,25 +40,17 @@ class helper_collection // note: we dont' actually "share" the function object pointer // we only use shared_ptr to make sure that it get's deleted - #ifndef BOOST_NO_CXX11_SMART_PTR - typedef std::pair< - const void *, - std::shared_ptr<void> - > helper_value_type; - template<class T> - std::shared_ptr<void> make_helper_ptr(){ - return std::make_shared<T>(); - } - #else - typedef std::pair< - const void *, - boost::shared_ptr<void> - > helper_value_type; - template<class T> - boost::shared_ptr<void> make_helper_ptr(){ - return boost::make_shared<T>(); - } - #endif + typedef std::pair< + const void *, + boost::shared_ptr<void> + > helper_value_type; + template<class T> + boost::shared_ptr<void> make_helper_ptr(){ + // use boost::shared_ptr rather than std::shared_ptr to maintain + // c++03 compatibility + return boost::make_shared<T>(); + } + typedef std::vector<helper_value_type> collection; collection m_collection; @@ -69,6 +59,7 @@ class helper_collection bool operator()(helper_value_type const &rhs) const { return m_ti == rhs.first; } + predicate & operator=(const void * ti); // to suppress warning predicate(const void * ti) : m_ti(ti) {} @@ -79,7 +70,6 @@ protected: public: template<typename Helper> Helper& get_helper(void * const id = 0) { - collection::const_iterator it = std::find_if( m_collection.begin(), @@ -87,7 +77,7 @@ public: predicate(id) ); - void * rval; + void * rval = 0; if(it == m_collection.end()){ m_collection.push_back( std::make_pair(id, make_helper_ptr<Helper>()) |