Opened 10 years ago
Closed 10 years ago
#7749 closed Bugs (invalid)
In Assignment operator, argument should be passed by reference.
| Reported by: | Owned by: | Joaquín M López Muñoz | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | multi_index |
| Version: | Boost 1.52.0 | Severity: | Problem |
| Keywords: | Cc: | yogen.saini@… |
Description
In file boost/multi_index_container.hpp When defining the assignment operator, argument is not passed by reference.
multi_index_container<Value,IndexSpecifierList,Allocator>& operator=(
multi_index_container<Value,IndexSpecifierList,Allocator> x)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
this->swap(x);
return *this;
}
Attached patch is fix for it.
Attachments (1)
Change History (2)
by , 10 years ago
| Attachment: | multi_index_container.hpp_patch added |
|---|
comment:1 by , 10 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
This manner of implementing assignment operator is not a bug. It's described in Sutter and Alexandrescu's C++ Coding Standards and more briefly on the Wikipedia.
BTW, your patch is invalid: it'd rule out assignment from a const object.
Note:
See TracTickets
for help on using tickets.

Proposed patch for the bug raised