1// (C) Copyright Gennadiy Rozental 2001.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8// File : $RCSfile$
9//
10// Version : $Revision: 74248 $
11//
12// Description : toolbox implementation details
13// ***************************************************************************
14
15#ifndef BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
16#define BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
17
18#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS
19
20#include <boost/test/detail/suppress_warnings.hpp>
21
22//____________________________________________________________________________//
23
24namespace boost {
25namespace test_tools {
26namespace tt_detail {
27
28// ************************************************************************** //
29// ************** tt_detail::expression_holder ************** //
30// ************************************************************************** //
31
32class expression_holder {
33public:
34 virtual ~expression_holder() {}
35 virtual assertion_result evaluate( bool no_message = false ) const = 0;
36};
37
38//____________________________________________________________________________//
39
40template<typename E>
41class expression_holder_t: public expression_holder {
42public:
43 explicit expression_holder_t( E const& e ) : m_expr( e ) {}
44
45private:
46 virtual assertion_result evaluate( bool no_message = false ) const { return m_expr.evaluate( no_message ); }
47
48 E m_expr;
49};
50
51//____________________________________________________________________________//
52
53template<typename E>
54expression_holder_t<E>
55hold_expression( E const& e )
56{
57 return expression_holder_t<E>( e );
58}
59
60//____________________________________________________________________________//
61
62} // namespace tt_detail
63} // namespace test_tools
64} // namespace boost
65
66#include <boost/test/detail/enable_warnings.hpp>
67
68#endif
69
70#endif // BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
71