blob: c1b6c12b865cbad964a7cde66f715c7a987a3118 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright Joakim Karlsson & Kim Gräsman 2010-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef IGLOO_OREXPRESSION_H
#define IGLOO_OREXPRESSION_H
#include "./expression_fwd.h"
namespace snowhouse {
template< typename LeftExpression, typename RightExpression >
struct OrExpression : Expression< OrExpression<LeftExpression, RightExpression> >
{
OrExpression(const LeftExpression& left, const RightExpression& right)
: m_left(left)
, m_right(right)
{
}
template< typename ActualType >
bool operator()(const ActualType& actual) const
{
return (m_left(actual) || m_right(actual));
}
LeftExpression m_left;
RightExpression m_right;
};
template< typename LeftExpression, typename RightExpression >
struct Stringizer< OrExpression<LeftExpression, RightExpression> >
{
static std::string ToString(const OrExpression<LeftExpression, RightExpression>& expression)
{
std::ostringstream builder;
builder << snowhouse::Stringize(expression.m_left) << " or " << snowhouse::Stringize(expression.m_right);
return builder.str();
}
};
}
#endif
|