Opened 11 years ago

Closed 11 years ago

#1908 closed Bugs (invalid)

boost::size(std::set<T> const& s) causes compile errors with msvc

Reported by: Shayne Fletcher <fletch@…> Owned by: Thorsten Ottosen
Milestone: Boost 1.36.0 Component: range
Version: Boost 1.35.0 Severity: Problem
Keywords: range msvc size set Cc:

Description

Found to be the case for (at least) msvc-7.1 and msvc-9.0 (express). No problem with mingw/gcc-3.4. Minimal program for reproducing the problem attached.

Attachments (1)

main.cpp (123 bytes) - added by Shayne Fletcher <fletch@…> 11 years ago.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Shayne Fletcher <fletch@…>

Attachment: main.cpp added

comment:1 Changed 11 years ago by fletch@…

Recent comments on the boost dev list suggest this failure is intentional; set iterators are not in the random access category (and so size can not be computed in O(1)). Happy to withdraw this report if that is indeed the case.

comment:2 Changed 11 years ago by Thorsten Ottosen

Resolution: invalid
Status: newclosed

That is correct. Use

boost::distance(rng)

instead.

-Thorsten

Note: See TracTickets for help on using tickets.