diff options
Diffstat (limited to 'src/boost/libs/hana/example/pair')
-rw-r--r-- | src/boost/libs/hana/example/pair/comparable.cpp | 15 | ||||
-rw-r--r-- | src/boost/libs/hana/example/pair/foldable.cpp | 16 | ||||
-rw-r--r-- | src/boost/libs/hana/example/pair/make.cpp | 17 | ||||
-rw-r--r-- | src/boost/libs/hana/example/pair/orderable.cpp | 14 | ||||
-rw-r--r-- | src/boost/libs/hana/example/pair/product.cpp | 14 |
5 files changed, 76 insertions, 0 deletions
diff --git a/src/boost/libs/hana/example/pair/comparable.cpp b/src/boost/libs/hana/example/pair/comparable.cpp new file mode 100644 index 00000000..63610e2f --- /dev/null +++ b/src/boost/libs/hana/example/pair/comparable.cpp @@ -0,0 +1,15 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#include <boost/hana/equal.hpp> +#include <boost/hana/not_equal.hpp> +#include <boost/hana/pair.hpp> +namespace hana = boost::hana; + + +static_assert(hana::make_pair(1, 'x') == hana::make_pair(1, 'x'), ""); +static_assert(hana::make_pair(2, 'x') != hana::make_pair(1, 'x'), ""); +static_assert(hana::make_pair(1, 'y') != hana::make_pair(1, 'x'), ""); + +int main() { } diff --git a/src/boost/libs/hana/example/pair/foldable.cpp b/src/boost/libs/hana/example/pair/foldable.cpp new file mode 100644 index 00000000..e9e92c74 --- /dev/null +++ b/src/boost/libs/hana/example/pair/foldable.cpp @@ -0,0 +1,16 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#include <boost/hana/fold_left.hpp> +#include <boost/hana/fold_right.hpp> +#include <boost/hana/minus.hpp> +#include <boost/hana/pair.hpp> +#include <boost/hana/plus.hpp> +namespace hana = boost::hana; + + +static_assert(hana::fold_left(hana::make_pair(1, 3), 0, hana::plus) == 4, ""); +static_assert(hana::fold_right(hana::make_pair(1, 3), 0, hana::minus) == -2, ""); + +int main() { } diff --git a/src/boost/libs/hana/example/pair/make.cpp b/src/boost/libs/hana/example/pair/make.cpp new file mode 100644 index 00000000..f13e3de9 --- /dev/null +++ b/src/boost/libs/hana/example/pair/make.cpp @@ -0,0 +1,17 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#include <boost/hana/core/make.hpp> +#include <boost/hana/equal.hpp> +#include <boost/hana/first.hpp> +#include <boost/hana/pair.hpp> +#include <boost/hana/second.hpp> +namespace hana = boost::hana; + + +static_assert(hana::first(hana::make<hana::pair_tag>(1, 'x')) == 1, ""); +static_assert(hana::second(hana::make<hana::pair_tag>(1, 'x')) == 'x', ""); +static_assert(hana::make_pair(1, 'x') == hana::make<hana::pair_tag>(1, 'x'), ""); + +int main() { } diff --git a/src/boost/libs/hana/example/pair/orderable.cpp b/src/boost/libs/hana/example/pair/orderable.cpp new file mode 100644 index 00000000..14c87e5b --- /dev/null +++ b/src/boost/libs/hana/example/pair/orderable.cpp @@ -0,0 +1,14 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#include <boost/hana/less.hpp> +#include <boost/hana/pair.hpp> +namespace hana = boost::hana; + + +static_assert(hana::make_pair(1, 'x') < hana::make_pair(1, 'y'), ""); +static_assert(hana::make_pair(1, 'x') < hana::make_pair(10, 'x'), ""); +static_assert(hana::make_pair(1, 'y') < hana::make_pair(10, 'x'), ""); + +int main() { } diff --git a/src/boost/libs/hana/example/pair/product.cpp b/src/boost/libs/hana/example/pair/product.cpp new file mode 100644 index 00000000..c48db2ce --- /dev/null +++ b/src/boost/libs/hana/example/pair/product.cpp @@ -0,0 +1,14 @@ +// Copyright Louis Dionne 2013-2017 +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + +#include <boost/hana/first.hpp> +#include <boost/hana/pair.hpp> +#include <boost/hana/second.hpp> +namespace hana = boost::hana; + + +static_assert(hana::first(hana::make_pair(1, 'x')) == 1, ""); +static_assert(hana::second(hana::make_pair(1, 'x')) == 'x', ""); + +int main() { } |