forked from boostorg/function
function.hpp:
- Added self-assignment check in operator= and set() function_template.hpp: - Added self-assignment check in operator= and set() [SVN r10431]
This commit is contained in:
@ -462,6 +462,9 @@ namespace boost {
|
||||
|
||||
function& operator=(const function& f)
|
||||
{
|
||||
if (this == &f)
|
||||
return *this;
|
||||
|
||||
const base_type& bf = static_cast<const base_type&>(f);
|
||||
base_type* self = this;
|
||||
self->set(bf);
|
||||
@ -470,6 +473,9 @@ namespace boost {
|
||||
|
||||
void set(const function& f)
|
||||
{
|
||||
if (this == &f)
|
||||
return;
|
||||
|
||||
const base_type& bf = static_cast<const base_type&>(f);
|
||||
base_type* self = this;
|
||||
self->set(bf);
|
||||
|
Reference in New Issue
Block a user