mirror of
https://github.com/boostorg/function.git
synced 2025-07-16 22:22:12 +02:00
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);
|
||||
|
@ -1044,6 +1044,9 @@ namespace boost {
|
||||
// Assignment from another BOOST_FUNCTION_FUNCTION
|
||||
BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f)
|
||||
{
|
||||
if (this == &f)
|
||||
return *this;
|
||||
|
||||
clear();
|
||||
|
||||
if (!f.empty()) {
|
||||
@ -1064,6 +1067,9 @@ namespace boost {
|
||||
// Assignment from another BOOST_FUNCTION_FUNCTION
|
||||
void set(const BOOST_FUNCTION_FUNCTION& f)
|
||||
{
|
||||
if (this == &f)
|
||||
return;
|
||||
|
||||
clear();
|
||||
|
||||
if (!f.empty()) {
|
||||
@ -1624,6 +1630,9 @@ namespace boost {
|
||||
// Assignment from another BOOST_FUNCTION_FUNCTION
|
||||
BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f)
|
||||
{
|
||||
if (this == &f)
|
||||
return *this;
|
||||
|
||||
clear();
|
||||
|
||||
if (!f.empty()) {
|
||||
@ -1644,6 +1653,9 @@ namespace boost {
|
||||
// Assignment from another BOOST_FUNCTION_FUNCTION
|
||||
void set(const BOOST_FUNCTION_FUNCTION& f)
|
||||
{
|
||||
if (this == &f)
|
||||
return;
|
||||
|
||||
clear();
|
||||
|
||||
if (!f.empty()) {
|
||||
|
Reference in New Issue
Block a user