mirror of
https://github.com/boostorg/function.git
synced 2025-07-26 02:47:16 +02:00
Use boost/assert.hpp to check (at runtime) if the int passed to Boost.Function's
clearing constructor is zero [SVN r16614]
This commit is contained in:
@ -21,6 +21,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/assert.hpp>
|
||||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||||
#include <boost/type_traits/composite_traits.hpp>
|
#include <boost/type_traits/composite_traits.hpp>
|
||||||
#include <boost/type_traits/is_stateless.hpp>
|
#include <boost/type_traits/is_stateless.hpp>
|
||||||
|
@ -296,7 +296,10 @@ namespace boost {
|
|||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
||||||
BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {}
|
BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {}
|
||||||
#else
|
#else
|
||||||
BOOST_FUNCTION_FUNCTION(int) : function_base(), invoker(0) {}
|
BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0)
|
||||||
|
{
|
||||||
|
BOOST_ASSERT(zero == 0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) :
|
BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) :
|
||||||
@ -351,8 +354,9 @@ namespace boost {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
BOOST_FUNCTION_FUNCTION& operator=(int)
|
BOOST_FUNCTION_FUNCTION& operator=(int zero)
|
||||||
{
|
{
|
||||||
|
BOOST_ASSERT(zero == 0);
|
||||||
this->clear();
|
this->clear();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user