Modify

Ticket #3746 (closed Bugs: fixed)

Opened 4 years ago

Last modified 4 years ago

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: igaztanaga
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

Change History

comment:1 Changed 4 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from Boost 1.42.0 to Boost-1.45.0

Fixed for Boost 1.45 in release branch

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.