blob: b1719288c09ffe72c3a7b4bcdbc34451a3895486 (
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
|
// 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_CONSTRAINTADAPTER_H
#define IGLOO_CONSTRAINTADAPTER_H
namespace snowhouse {
template <typename ConstraintType>
struct ConstraintAdapter
{
ConstraintAdapter(const ConstraintType& constraint) : m_constraint(constraint)
{
}
template <typename ConstraintListType, typename ActualType>
void Evaluate(ConstraintListType& list, ResultStack& result, OperatorStack& operators, const ActualType& actual)
{
result.push(m_constraint(actual));
EvaluateConstraintList(list.m_tail, result, operators, actual);
}
ConstraintType m_constraint;
};
template<typename ConstraintType>
struct Stringizer< ConstraintAdapter<ConstraintType> >
{
static std::string ToString(const ConstraintAdapter<ConstraintType>& constraintAdapter)
{
return snowhouse::Stringize(constraintAdapter.m_constraint);
}
};
}
#endif
|