Skip to content

Topic/gh 323 lazy ostream check printable sooner #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/closing_chapters/change_log.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Boost.Test releases:
# [pull_request 275] Replace anonymous `enum` arity with `static constexpr`
# [pull_request 278] Use `boost_test_print_type` customization point in `lazy_ostream`
# [pull_request 281] Export `execution_aborted` exception to allow catching it from outside the DLL
# [pull_request 323] Check that `lazy_ostream` argument is printable

[#ref_CHANGE_LOG_3_14][h4 Boost.Test v3.14 / boost 1.74]

Expand Down
6 changes: 6 additions & 0 deletions include/boost/test/utils/lazy_ostream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include <boost/test/detail/config.hpp>
#include <boost/test/tools/detail/print_helper.hpp>

// Boost
#include <boost/static_assert.hpp>
#include <boost/type_traits/has_left_shift.hpp>

// STL
#include <iosfwd>

Expand Down Expand Up @@ -75,6 +79,8 @@ class lazy_ostream_impl : public lazy_ostream {
, m_prev( prev )
, m_value( value )
{
BOOST_STATIC_ASSERT_MSG( (boost::has_left_shift<std::ostream,T>::value),
"Type has to implement operator<< to be printable");
}

std::ostream& operator()( std::ostream& ostr ) const BOOST_OVERRIDE
Expand Down