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 | |
24 | namespace boost { |
25 | namespace test_tools { |
26 | namespace tt_detail { |
27 | |
28 | // ************************************************************************** // |
29 | // ************** tt_detail::expression_holder ************** // |
30 | // ************************************************************************** // |
31 | |
32 | class expression_holder { |
33 | public: |
34 | virtual ~expression_holder() {} |
35 | virtual assertion_result evaluate( bool no_message = false ) const = 0; |
36 | }; |
37 | |
38 | //____________________________________________________________________________// |
39 | |
40 | template<typename E> |
41 | class expression_holder_t: public expression_holder { |
42 | public: |
43 | explicit expression_holder_t( E const& e ) : m_expr( e ) {} |
44 | |
45 | private: |
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 | |
53 | template<typename E> |
54 | expression_holder_t<E> |
55 | hold_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 | |