-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from banditcpp/issue-14
Make IsEmpty() and Is().Empty() independent of size() method
- Loading branch information
Showing
6 changed files
with
62 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (C) 2017 Stephan Beyer | ||
// 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 SNOWHOUSE_ISEMPTYCONSTRAINT_H | ||
#define SNOWHOUSE_ISEMPTYCONSTRAINT_H | ||
|
||
#include "expressions/expression.h" | ||
|
||
namespace snowhouse | ||
{ | ||
struct IsEmptyConstraint : Expression<IsEmptyConstraint> | ||
{ | ||
// The ignored default argument is a workaround to make this class | ||
// compatible to ConstraintAdapterType | ||
IsEmptyConstraint(int = 0) | ||
{ | ||
} | ||
|
||
template<typename ActualType> | ||
bool operator()(const ActualType& actual) const | ||
{ | ||
return actual.empty(); | ||
} | ||
}; | ||
|
||
inline IsEmptyConstraint IsEmpty() | ||
{ | ||
return IsEmptyConstraint(); | ||
} | ||
|
||
template<> | ||
struct Stringizer<IsEmptyConstraint> | ||
{ | ||
static std::string ToString(const IsEmptyConstraint&) | ||
{ | ||
return "empty"; | ||
} | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters