Modify

Opened 8 years ago

Closed 7 years ago

#3746 closed Bugs (fixed)

list_iterator::operator == fails to accept a non-const var to the left and a const one to the right

Reported by: gvlad@… Owned by: Ion Gaztañaga
Milestone: Boost 1.45.0 Component: intrusive
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

The following code fails to compile (msvc 9):

using namespace boost::intrusive; struct my_struct : list_base_hook<> {}; typedef list<my_struct> my_list; my_list l; my_list::const_iterator it = l.begin(); if (l.end() == it) {} fails if (it == l.end()) {} succeeds

If to use std::list there is no such problem because std::list::iterator is derived from std::list::const_iterator. My suggesion is to use template "operator ==" for list_iterator that accepts both const and non-const interator. For example:

("list_node.hpp") template <bool IsOtherConst?> bool operator== (const list_iterator<Container, IsOtherConst?>& i) const

{ return members_.nodeptr_ == i.pointed_node(); }

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Ion Gaztañaga

Milestone: Boost 1.42.0Boost-1.45.0
Resolution: fixed
Status: newclosed

Fixed for Boost 1.45 in release branch

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.