In common.h, define func_lib for function objects. In configure.ac, define HAVE_STD_FUNCTION and HAVE_BOOST_FUNCTION. Include function headers in ndnboost.
diff --git a/ndnboost/smart_ptr/detail/allocate_array_helper.hpp b/ndnboost/smart_ptr/detail/allocate_array_helper.hpp
index a67e6e8..a0ad380 100644
--- a/ndnboost/smart_ptr/detail/allocate_array_helper.hpp
+++ b/ndnboost/smart_ptr/detail/allocate_array_helper.hpp
@@ -33,10 +33,10 @@
struct rebind {
typedef allocate_array_helper<A, T[], U> other;
};
- allocate_array_helper(const A& allocator, std::size_t size, T** data)
- : allocator(allocator),
- size(sizeof(T) * size),
- data(data) {
+ allocate_array_helper(const A& allocator_, std::size_t size_, T** data_)
+ : allocator(allocator_),
+ size(sizeof(T) * size_),
+ data(data_) {
}
template<class U>
allocate_array_helper(const allocate_array_helper<A, T[], U>& other)
@@ -107,9 +107,9 @@
struct rebind {
typedef allocate_array_helper<A, T[N], U> other;
};
- allocate_array_helper(const A& allocator, T** data)
- : allocator(allocator),
- data(data) {
+ allocate_array_helper(const A& allocator_, T** data_)
+ : allocator(allocator_),
+ data(data_) {
}
template<class U>
allocate_array_helper(const allocate_array_helper<A, T[N], U>& other)
diff --git a/ndnboost/smart_ptr/detail/array_deleter.hpp b/ndnboost/smart_ptr/detail/array_deleter.hpp
index 2afe96c..14dcfb2 100644
--- a/ndnboost/smart_ptr/detail/array_deleter.hpp
+++ b/ndnboost/smart_ptr/detail/array_deleter.hpp
@@ -19,8 +19,8 @@
template<typename T>
class array_deleter<T[]> {
public:
- array_deleter(std::size_t size)
- : size(size),
+ array_deleter(std::size_t size_)
+ : size(size_),
object(0) {
}
~array_deleter() {
diff --git a/ndnboost/smart_ptr/detail/make_array_helper.hpp b/ndnboost/smart_ptr/detail/make_array_helper.hpp
index e989f22..1105137 100644
--- a/ndnboost/smart_ptr/detail/make_array_helper.hpp
+++ b/ndnboost/smart_ptr/detail/make_array_helper.hpp
@@ -31,9 +31,9 @@
struct rebind {
typedef make_array_helper<T[], U> other;
};
- make_array_helper(std::size_t size, T** data)
- : size(sizeof(T) * size),
- data(data) {
+ make_array_helper(std::size_t size_, T** data_)
+ : size(sizeof(T) * size_),
+ data(data_) {
}
template<class U>
make_array_helper(const make_array_helper<T[], U>& other)
@@ -72,7 +72,7 @@
memory->~Y();
}
template<typename U>
- bool operator==(const make_array_helper<T[], U>& other) const {
+ bool operator==(const make_array_helper<T[], U>&) const {
return true;
}
template<typename U>
@@ -99,8 +99,8 @@
struct rebind {
typedef make_array_helper<T[N], U> other;
};
- make_array_helper(T** data)
- : data(data) {
+ make_array_helper(T** data_)
+ : data(data_) {
}
template<class U>
make_array_helper(const make_array_helper<T[N], U>& other)
@@ -138,7 +138,7 @@
memory->~Y();
}
template<typename U>
- bool operator==(const make_array_helper<T[N], U>& other) const {
+ bool operator==(const make_array_helper<T[N], U>&) const {
return true;
}
template<typename U>
diff --git a/ndnboost/smart_ptr/detail/shared_count.hpp b/ndnboost/smart_ptr/detail/shared_count.hpp
index ad53ec0..f723584 100644
--- a/ndnboost/smart_ptr/detail/shared_count.hpp
+++ b/ndnboost/smart_ptr/detail/shared_count.hpp
@@ -200,7 +200,7 @@
}
catch( ... )
{
- D()( p ); // delete p
+ D::operator_fn( p ); // delete p
throw;
}
@@ -210,7 +210,7 @@
if( pi_ == 0 )
{
- D()( p ); // delete p
+ D::operator_fn( p ); // delete p
ndnboost::throw_exception( std::bad_alloc() );
}
@@ -286,7 +286,7 @@
}
catch(...)
{
- D()( p );
+ D::operator_fn( p );
if( pi_ != 0 )
{
@@ -306,7 +306,7 @@
}
else
{
- D()( p );
+ D::operator_fn( p );
ndnboost::throw_exception( std::bad_alloc() );
}
diff --git a/ndnboost/smart_ptr/make_shared_object.hpp b/ndnboost/smart_ptr/make_shared_object.hpp
index 1d1ae7a..513dfc2 100644
--- a/ndnboost/smart_ptr/make_shared_object.hpp
+++ b/ndnboost/smart_ptr/make_shared_object.hpp
@@ -87,6 +87,10 @@
destroy();
}
+ static void operator_fn( T* ) // operator() can't be static
+ {
+ }
+
void * address() BOOST_NOEXCEPT
{
return storage_.data_;
diff --git a/ndnboost/smart_ptr/shared_ptr.hpp b/ndnboost/smart_ptr/shared_ptr.hpp
index 78d6e30..52b9acc 100644
--- a/ndnboost/smart_ptr/shared_ptr.hpp
+++ b/ndnboost/smart_ptr/shared_ptr.hpp
@@ -485,7 +485,7 @@
#endif // BOOST_NO_AUTO_PTR
-#if !defined( BOOST_NO_CXX11_SMART_PTR )
+#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template< class Y, class D >
shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn()
@@ -550,7 +550,7 @@
#endif // BOOST_NO_AUTO_PTR
-#if !defined( BOOST_NO_CXX11_SMART_PTR )
+#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y, class D>
shared_ptr & operator=( std::unique_ptr<Y, D> && r )