Use explicit streaming ops instead of Boost.LexicalCast

This commit is contained in:
Alexander Grund 2020-07-12 13:38:54 +02:00
parent 898a5a4524
commit 04dff97fde
No known key found for this signature in database
GPG key ID: AA48A0760367A42B
5 changed files with 24 additions and 17 deletions

View file

@ -35,13 +35,15 @@ namespace
//]
//[ quick_constraint_solution
#include <boost/lexical_cast.hpp>
#include <sstream>
namespace // in the same namespace as 'my_class'
{
bool operator==( const my_class& actual, const std::string& expected ) // the first part of the trick is to compare to a string
{
return boost::lexical_cast< std::string >( actual ) == expected;
std::ostringstream s;
s << actual;
return s.str() == expected;
}
} // mock