diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/hana/example/pair | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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() { } |