From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/boost/libs/hana/example/set/comparable.cpp | 26 ++++++++++++++++++++ src/boost/libs/hana/example/set/difference.cpp | 20 ++++++++++++++++ src/boost/libs/hana/example/set/erase_key.cpp | 19 +++++++++++++++ src/boost/libs/hana/example/set/foldable.cpp | 20 ++++++++++++++++ src/boost/libs/hana/example/set/insert.cpp | 25 +++++++++++++++++++ src/boost/libs/hana/example/set/intersection.cpp | 19 +++++++++++++++ src/boost/libs/hana/example/set/make.cpp | 17 +++++++++++++ src/boost/libs/hana/example/set/searchable.cpp | 25 +++++++++++++++++++ .../libs/hana/example/set/symmetric_difference.cpp | 19 +++++++++++++++ src/boost/libs/hana/example/set/to.cpp | 28 ++++++++++++++++++++++ src/boost/libs/hana/example/set/union.cpp | 23 ++++++++++++++++++ 11 files changed, 241 insertions(+) create mode 100644 src/boost/libs/hana/example/set/comparable.cpp create mode 100644 src/boost/libs/hana/example/set/difference.cpp create mode 100644 src/boost/libs/hana/example/set/erase_key.cpp create mode 100644 src/boost/libs/hana/example/set/foldable.cpp create mode 100644 src/boost/libs/hana/example/set/insert.cpp create mode 100644 src/boost/libs/hana/example/set/intersection.cpp create mode 100644 src/boost/libs/hana/example/set/make.cpp create mode 100644 src/boost/libs/hana/example/set/searchable.cpp create mode 100644 src/boost/libs/hana/example/set/symmetric_difference.cpp create mode 100644 src/boost/libs/hana/example/set/to.cpp create mode 100644 src/boost/libs/hana/example/set/union.cpp (limited to 'src/boost/libs/hana/example/set') diff --git a/src/boost/libs/hana/example/set/comparable.cpp b/src/boost/libs/hana/example/set/comparable.cpp new file mode 100644 index 000000000..4bc2ecadb --- /dev/null +++ b/src/boost/libs/hana/example/set/comparable.cpp @@ -0,0 +1,26 @@ +// 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 +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +int main() { + BOOST_HANA_CONSTANT_CHECK( + hana::make_set(hana::int_c<0>, hana::type_c, hana::int_c<1>) + == + hana::make_set(hana::int_c<1>, hana::int_c<0>, hana::type_c) + ); + + BOOST_HANA_CONSTANT_CHECK( + hana::make_set(hana::int_c<0>, hana::type_c) + != + hana::make_set(hana::int_c<1>) + ); +} diff --git a/src/boost/libs/hana/example/set/difference.cpp b/src/boost/libs/hana/example/set/difference.cpp new file mode 100644 index 000000000..e91a9222d --- /dev/null +++ b/src/boost/libs/hana/example/set/difference.cpp @@ -0,0 +1,20 @@ +// 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 +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +constexpr auto xs = hana::make_set(hana::int_c<1>, hana::int_c<2>, hana::type_c, hana::int_c<3>); +constexpr auto ys = hana::make_set(hana::int_c<3>, hana::type_c, hana::type_c); + +BOOST_HANA_CONSTANT_CHECK(hana::difference(xs, ys) == hana::make_set(hana::int_c<1>, hana::int_c<2>)); +BOOST_HANA_CONSTANT_CHECK(hana::difference(ys, xs) == hana::make_set(hana::type_c)); + +int main() { } diff --git a/src/boost/libs/hana/example/set/erase_key.cpp b/src/boost/libs/hana/example/set/erase_key.cpp new file mode 100644 index 000000000..d3bc3cd56 --- /dev/null +++ b/src/boost/libs/hana/example/set/erase_key.cpp @@ -0,0 +1,19 @@ +// 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 +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +int main() { + constexpr auto xs = hana::make_set(hana::int_c<0>, hana::type_c, hana::type_c); + + BOOST_HANA_CONSTANT_CHECK(hana::erase_key(xs, hana::type_c) == hana::make_set(hana::int_c<0>, hana::type_c)); + BOOST_HANA_CONSTANT_CHECK(hana::erase_key(xs, hana::type_c) == xs); +} diff --git a/src/boost/libs/hana/example/set/foldable.cpp b/src/boost/libs/hana/example/set/foldable.cpp new file mode 100644 index 000000000..0f17415eb --- /dev/null +++ b/src/boost/libs/hana/example/set/foldable.cpp @@ -0,0 +1,20 @@ +// 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 +#include +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +int main() { + constexpr auto xs = hana::make_set(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>); + static_assert(hana::minimum(xs) == hana::int_c<0>, ""); + static_assert(hana::maximum(xs) == hana::int_c<2>, ""); + static_assert(hana::sum<>(xs) == hana::int_c<3>, ""); +} diff --git a/src/boost/libs/hana/example/set/insert.cpp b/src/boost/libs/hana/example/set/insert.cpp new file mode 100644 index 000000000..47fffc760 --- /dev/null +++ b/src/boost/libs/hana/example/set/insert.cpp @@ -0,0 +1,25 @@ +// 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 +#include +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +int main() { + constexpr auto xs = hana::make_set(hana::int_c<0>, hana::type_c); + BOOST_HANA_CONSTANT_CHECK( + hana::insert(xs, BOOST_HANA_STRING("abc")) == + hana::make_set(hana::int_c<0>, hana::type_c, BOOST_HANA_STRING("abc")) + ); + + BOOST_HANA_CONSTANT_CHECK( + hana::insert(xs, hana::int_c<0>) == hana::make_set(hana::int_c<0>, hana::type_c) + ); +} diff --git a/src/boost/libs/hana/example/set/intersection.cpp b/src/boost/libs/hana/example/set/intersection.cpp new file mode 100644 index 000000000..1d080432b --- /dev/null +++ b/src/boost/libs/hana/example/set/intersection.cpp @@ -0,0 +1,19 @@ +// 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 +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +constexpr auto xs = hana::make_set(hana::int_c<1>, hana::type_c, hana::int_c<2>); +constexpr auto ys = hana::make_set(hana::int_c<2>, hana::type_c, hana::int_c<3>); + +BOOST_HANA_CONSTANT_CHECK(hana::intersection(xs, ys) == hana::make_set(hana::int_c<2>)); + +int main() { } diff --git a/src/boost/libs/hana/example/set/make.cpp b/src/boost/libs/hana/example/set/make.cpp new file mode 100644 index 000000000..08f848340 --- /dev/null +++ b/src/boost/libs/hana/example/set/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 +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +constexpr auto xs = hana::make_set(hana::int_c<1>, hana::type_c); +BOOST_HANA_CONSTANT_CHECK(xs == hana::make(hana::int_c<1>, hana::type_c)); + +int main() { } diff --git a/src/boost/libs/hana/example/set/searchable.cpp b/src/boost/libs/hana/example/set/searchable.cpp new file mode 100644 index 000000000..81fa26933 --- /dev/null +++ b/src/boost/libs/hana/example/set/searchable.cpp @@ -0,0 +1,25 @@ +// 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 +#include +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +int main() { + constexpr auto xs = hana::make_set(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>); + BOOST_HANA_CONSTANT_CHECK(hana::find(xs, hana::int_c<0>) == hana::just(hana::int_c<0>)); + BOOST_HANA_CONSTANT_CHECK(hana::find(xs, hana::int_c<3>) == hana::nothing); + + // operator[] is equivalent to at_key + BOOST_HANA_CONSTANT_CHECK(xs[hana::int_c<2>] == hana::int_c<2>); + + // long_c<0> == int_<0>, and therefore int_<0> is found + BOOST_HANA_CONSTANT_CHECK(xs[hana::long_c<0>] == hana::int_c<0>); +} diff --git a/src/boost/libs/hana/example/set/symmetric_difference.cpp b/src/boost/libs/hana/example/set/symmetric_difference.cpp new file mode 100644 index 000000000..0e66e73e7 --- /dev/null +++ b/src/boost/libs/hana/example/set/symmetric_difference.cpp @@ -0,0 +1,19 @@ +// 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 +#include +#include + +namespace hana = boost::hana; + + +constexpr auto xs = hana::make_set(hana::int_c<1>, hana::int_c<2>, hana::type_c, hana::int_c<3>); +constexpr auto ys = hana::make_set(hana::int_c<3>, hana::type_c, hana::type_c); + +BOOST_HANA_CONSTANT_CHECK( + hana::symmetric_difference(xs, ys) == hana::make_set(hana::int_c<1>, hana::int_c<2>, hana::type_c) +); + +int main() { } diff --git a/src/boost/libs/hana/example/set/to.cpp b/src/boost/libs/hana/example/set/to.cpp new file mode 100644 index 000000000..59f0cb919 --- /dev/null +++ b/src/boost/libs/hana/example/set/to.cpp @@ -0,0 +1,28 @@ +// 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 +#include +#include +#include +#include +#include +#include +namespace hana = boost::hana; + + +int main() { + constexpr auto xs = hana::make_tuple( + hana::int_c<1>, + hana::int_c<3>, + hana::type_c, + hana::long_c<1> + ); + + BOOST_HANA_CONSTANT_CHECK( + hana::to(xs) + == + hana::make_set(hana::int_c<1>, hana::int_c<3>, hana::type_c) + ); +} diff --git a/src/boost/libs/hana/example/set/union.cpp b/src/boost/libs/hana/example/set/union.cpp new file mode 100644 index 000000000..b52d1d4ac --- /dev/null +++ b/src/boost/libs/hana/example/set/union.cpp @@ -0,0 +1,23 @@ +// 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 +#include +#include +#include +#include +#include +#include +namespace hana = boost::hana; +using namespace hana::literals; + + +constexpr auto xs = hana::make_set(hana::int_c<1>, hana::type_c, hana::int_c<2>); +constexpr auto ys = hana::make_set(hana::int_c<2>, hana::type_c, hana::int_c<3>); + +BOOST_HANA_CONSTANT_CHECK(hana::union_(xs, ys) == hana::make_set( + hana::int_c<1>, hana::int_c<2>, hana::int_c<3>, hana::type_c, hana::type_c +)); + +int main() { } -- cgit v1.2.3