diff options
Diffstat (limited to 'test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp')
-rw-r--r-- | test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp new file mode 100644 index 000000000000..d54222a97a1c --- /dev/null +++ b/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.comparison_function_objects/equal_to.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11 + +// <propagate_const> + +// template <class T> struct equal_to<experimental::fundamentals_v2::propagate_const<T>>; + +#include <experimental/propagate_const> +#include "propagate_const_helpers.h" +#include <cassert> + +using std::experimental::propagate_const; + +constexpr bool operator==(const X &x1, const X &x2) { return x1.i_ == x2.i_; } + +int main() { + + typedef propagate_const<X> P; + + P p1_1(1); + P p2_1(1); + P p3_2(2); + + auto c = std::equal_to<P>(); + + assert(c(p1_1,p2_1)); + assert(!c(p1_1,p3_2)); +} |