Phil Nash | ce612bf | 2012-11-01 08:27:09 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Created by Phil on 11/5/2012. |
| 3 | * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. |
| 4 | * |
| 5 | * Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 6 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 7 | */ |
| 8 | #ifndef TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED |
| 9 | #define TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED |
| 10 | |
| 11 | #include "catch_expression_lhs.hpp" |
| 12 | |
| 13 | namespace Catch { |
| 14 | |
| 15 | // Captures the LHS of the expression and wraps it in an Expression Lhs object |
| 16 | class ExpressionDecomposer { |
| 17 | public: |
| 18 | |
| 19 | template<typename T> |
| 20 | ExpressionLhs<const T&> operator->* ( const T & operand ) { |
| 21 | return ExpressionLhs<const T&>( operand ); |
| 22 | } |
| 23 | |
| 24 | ExpressionLhs<bool> operator->* ( bool value ) { |
| 25 | return ExpressionLhs<bool>( value ); |
| 26 | } |
| 27 | }; |
| 28 | |
| 29 | } // end namespace Catch |
| 30 | |
| 31 | #endif // TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED |