1 // Copyright (C) 2017 Stephan Beyer
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 
5 #ifndef SNOWHOUSE_ISEMPTYCONSTRAINT_H
6 #define SNOWHOUSE_ISEMPTYCONSTRAINT_H
7 
8 #include "expressions/expression.h"
9 
10 namespace snowhouse
11 {
12   struct IsEmptyConstraint : Expression<IsEmptyConstraint>
13   {
14     // The ignored default argument is a workaround to make this class
15     // compatible to ConstraintAdapterType
16     IsEmptyConstraint(int = 0)
17     {
18     }
19 
20     template<typename ActualType>
operatorIsEmptyConstraint21     bool operator()(const ActualType& actual) const
22     {
23       return actual.empty();
24     }
25   };
26 
IsEmpty()27   inline IsEmptyConstraint IsEmpty()
28   {
29     return IsEmptyConstraint();
30   }
31 
32   template<>
33   struct Stringizer<IsEmptyConstraint>
34   {
35     static std::string ToString(const IsEmptyConstraint&)
36     {
37       return "empty";
38     }
39   };
40 }
41 
42 #endif
43