|
Boost : |
Subject: Re: [boost] [dynamic_bitset] Comparison operators without assertions
From: degski (degski_at_[hidden])
Date: 2017-05-17 08:21:23
On 17 May 2017 at 10:07, Pete Bartlett via Boost <boost_at_[hidden]>
wrote:
> I hope no one thinks it is hard to compare std::strings of non-equal
> lengths...!
>
Well... consider:
std::cout << ( std::string ( "0001" ) > std::string ( "000" ) ) << '\n';
std::cout << ( std::string ( "1110" ) > std::string ( "111" ) ) << '\n';
std::cout << ( std::string ( "0101" ) > std::string ( "000" ) ) << '\n';
std::cout << ( std::string ( "1010" ) < std::string ( "111" ) ) << '\n';
std::cout << ( std::string ( "000111" ) < std::string ( "111" ) ) <<
'\n';
std::cout << ( std::string ( "111000" ) > std::string ( "111" ) ) <<
'\n';
But I guess, problem solved:
http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare and
comparison of boost::dynamic_bitsets<> should neither throw or assert.
degski
-- "*Ihre sogenannte Religion wirkt bloà wie ein Opiat reizend, betäubend, Schmerzen aus Schwäche stillend.*" - Novalis 1798
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk