diff options
Diffstat (limited to '3rdparty/asio/src/tests/properties/cpp11')
57 files changed, 2627 insertions, 0 deletions
diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_free_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_free_prefer.cpp new file mode 100644 index 00000000000..860fa6fad5b --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_free_prefer.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_free_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> prefer(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_free_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_free_require.cpp new file mode 100644 index 00000000000..b842e9aa4e9 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_free_require.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_free_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_member_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_member_prefer.cpp new file mode 100644 index 00000000000..9f00cbcaf38 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_member_prefer.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_member_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> prefer(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_member_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_member_require.cpp new file mode 100644 index 00000000000..a81bae1ae1c --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_member_require.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_member_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_free_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_free_prefer.cpp new file mode 100644 index 00000000000..9079c1fc832 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_free_prefer.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_prefer_not_applicable_free_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> prefer(const object&, prop<N>) + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_free_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_free_require.cpp new file mode 100644 index 00000000000..52fc618ac97 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_free_require.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_prefer_not_applicable_free_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_member_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_member_prefer.cpp new file mode 100644 index 00000000000..93f0c85c934 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_member_prefer.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_prefer_not_applicable_member_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> prefer(prop<N>) const + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_member_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_member_require.cpp new file mode 100644 index 00000000000..e17ec93f80a --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_member_require.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_prefer_not_applicable_member_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_static.cpp new file mode 100644 index 00000000000..9087ed42332 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_static.cpp @@ -0,0 +1,45 @@ +// +// cpp11/can_prefer_not_applicable_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { +namespace traits { + +template<int N> +struct static_require<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_unsupported.cpp new file mode 100644 index 00000000000..b09d15708a1 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_applicable_unsupported.cpp @@ -0,0 +1,33 @@ +// +// cpp11/can_prefer_not_applicable_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ +}; + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_free_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_free_prefer.cpp new file mode 100644 index 00000000000..28a1d151b2d --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_free_prefer.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_not_preferable_free_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = false; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> prefer(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_free_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_free_require.cpp new file mode 100644 index 00000000000..cbb105416a4 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_free_require.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_not_preferable_free_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = false; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_member_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_member_prefer.cpp new file mode 100644 index 00000000000..2d460503b79 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_member_prefer.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_not_preferable_member_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = false; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> prefer(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_member_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_member_require.cpp new file mode 100644 index 00000000000..4e03c02d895 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_member_require.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_prefer_not_preferable_member_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = false; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_static.cpp new file mode 100644 index 00000000000..0791d8a02f5 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_static.cpp @@ -0,0 +1,43 @@ +// +// cpp11/can_prefer_not_preferable_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = false; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_unsupported.cpp new file mode 100644 index 00000000000..059944ece37 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_not_preferable_unsupported.cpp @@ -0,0 +1,43 @@ +// +// cpp11/can_prefer_not_preferable_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = false; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_static.cpp new file mode 100644 index 00000000000..c928f7ffd63 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_static.cpp @@ -0,0 +1,52 @@ +// +// cpp11/can_prefer_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<int N> +struct static_require<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(asio::can_prefer<object<1>, prop<1>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<1>, prop<1>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<1>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_prefer_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_unsupported.cpp new file mode 100644 index 00000000000..32d6ac5c0d3 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_prefer_unsupported.cpp @@ -0,0 +1,43 @@ +// +// cpp11/can_prefer_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_prefer<object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_free.cpp new file mode 100644 index 00000000000..330493ba328 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_free.cpp @@ -0,0 +1,37 @@ +// +// cpp11/can_query_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ + friend constexpr int query(const object&, prop) { return 123; } +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_query<object, prop>::value, ""); + static_assert(asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_member.cpp new file mode 100644 index 00000000000..e1442d9f296 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_member.cpp @@ -0,0 +1,37 @@ +// +// cpp11/can_query_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ + constexpr int query(prop) const { return 123; } +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_query<object, prop>::value, ""); + static_assert(asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_free.cpp new file mode 100644 index 00000000000..2be49af0c64 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_free.cpp @@ -0,0 +1,27 @@ +// +// cpp11/can_query_not_applicable_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ + friend constexpr int query(const object&, prop) { return 123; } +}; + +int main() +{ + static_assert(!asio::can_query<object, prop>::value, ""); + static_assert(!asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_member.cpp new file mode 100644 index 00000000000..788148df4a9 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_member.cpp @@ -0,0 +1,27 @@ +// +// cpp11/can_query_not_applicable_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ + constexpr int query(prop) const { return 123; } +}; + +int main() +{ + static_assert(!asio::can_query<object, prop>::value, ""); + static_assert(!asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_static.cpp new file mode 100644 index 00000000000..c57848c7a9f --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_static.cpp @@ -0,0 +1,41 @@ +// +// cpp11/can_query_not_applicable_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ +}; + +namespace asio { +namespace traits { + +template<> +struct static_query<object, prop> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; + typedef int result_type; + static constexpr int value() { return 123; } +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(!asio::can_query<object, prop>::value, ""); + static_assert(!asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_unsupported.cpp new file mode 100644 index 00000000000..79bff6231ab --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_not_applicable_unsupported.cpp @@ -0,0 +1,26 @@ +// +// cpp11/can_query_not_applicable_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ +}; + +int main() +{ + static_assert(!asio::can_query<object, prop>::value, ""); + static_assert(!asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_static.cpp new file mode 100644 index 00000000000..6dc25819a43 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_static.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_query_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<> +struct static_query<object, prop> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; + typedef int result_type; + static constexpr int value() { return 123; } +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(asio::can_query<object, prop>::value, ""); + static_assert(asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_query_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_query_unsupported.cpp new file mode 100644 index 00000000000..369955e474a --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_query_unsupported.cpp @@ -0,0 +1,36 @@ +// +// cpp11/can_query_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_query<object, prop>::value, ""); + static_assert(!asio::can_query<const object, prop>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_free.cpp new file mode 100644 index 00000000000..3dd617097a2 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_free.cpp @@ -0,0 +1,44 @@ +// +// cpp11/can_require_concept_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require_concept(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_member.cpp new file mode 100644 index 00000000000..55ac468247b --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_member.cpp @@ -0,0 +1,44 @@ +// +// cpp11/can_require_concept_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require_concept(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_free.cpp new file mode 100644 index 00000000000..af40b48bdec --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_free.cpp @@ -0,0 +1,34 @@ +// +// cpp11/can_require_concept_not_applicable_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require_concept(const object&, prop<N>) + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_member.cpp new file mode 100644 index 00000000000..baf6b9f482f --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_member.cpp @@ -0,0 +1,34 @@ +// +// cpp11/can_require_concept_not_applicable_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require_concept(prop<N>) const + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_static.cpp new file mode 100644 index 00000000000..7d7f13876d8 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_static.cpp @@ -0,0 +1,41 @@ +// +// cpp11/can_require_concept_not_applicable_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { +namespace traits { + +template<int N> +struct static_require_concept<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(!asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_unsupported.cpp new file mode 100644 index 00000000000..13e05b231b5 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_not_applicable_unsupported.cpp @@ -0,0 +1,28 @@ +// +// cpp11/can_require_concept_not_applicable_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ +}; + +template <int> +struct object +{ +}; + +int main() +{ + static_assert(!asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_static.cpp new file mode 100644 index 00000000000..07973a5bd14 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_static.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_require_concept_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<int N> +struct static_require_concept<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(asio::can_require_concept<object<1>, prop<1>>::value, ""); + static_assert(asio::can_require_concept<const object<1>, prop<1>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_unsupported.cpp new file mode 100644 index 00000000000..4a4fee1f705 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_concept_unsupported.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_require_concept_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_require_concept<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require_concept<const object<1>, prop<2>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_free.cpp new file mode 100644 index 00000000000..b66965e60e1 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_free.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_require_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_require<object<1>, prop<2>>::value, ""); + static_assert(asio::can_require<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_member.cpp new file mode 100644 index 00000000000..cac464174f1 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_member.cpp @@ -0,0 +1,48 @@ +// +// cpp11/can_require_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(asio::can_require<object<1>, prop<2>>::value, ""); + static_assert(asio::can_require<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<2>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_free.cpp new file mode 100644 index 00000000000..9705b87b244 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_free.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_require_not_applicable_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_require<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_member.cpp new file mode 100644 index 00000000000..cd7f75fef34 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_member.cpp @@ -0,0 +1,38 @@ +// +// cpp11/can_require_not_applicable_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +int main() +{ + static_assert(!asio::can_require<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_static.cpp new file mode 100644 index 00000000000..f852e451513 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_static.cpp @@ -0,0 +1,45 @@ +// +// cpp11/can_require_not_applicable_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { +namespace traits { + +template<int N> +struct static_require<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(!asio::can_require<object<1>, prop<1>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<1>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<1>, prop<1>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<1>, prop<1>, prop<1>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_unsupported.cpp new file mode 100644 index 00000000000..e6286aba02c --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_not_applicable_unsupported.cpp @@ -0,0 +1,32 @@ +// +// cpp11/can_require_not_applicable_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ +}; + +template <int> +struct object +{ +}; + +int main() +{ + static_assert(!asio::can_require<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_static.cpp new file mode 100644 index 00000000000..4c1b38fc2c0 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_static.cpp @@ -0,0 +1,52 @@ +// +// cpp11/can_require_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<int N> +struct static_require<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + static_assert(asio::can_require<object<1>, prop<1>>::value, ""); + static_assert(asio::can_require<object<1>, prop<1>, prop<1>>::value, ""); + static_assert(asio::can_require<object<1>, prop<1>, prop<1>, prop<1>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<1>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<1>, prop<1>>::value, ""); + static_assert(asio::can_require<const object<1>, prop<1>, prop<1>, prop<1>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/can_require_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/can_require_unsupported.cpp new file mode 100644 index 00000000000..bc9c4ed2072 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/can_require_unsupported.cpp @@ -0,0 +1,42 @@ +// +// cpp11/can_require_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + static_assert(!asio::can_require<object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>>::value, ""); + static_assert(!asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, ""); +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/prefer_free_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/prefer_free_prefer.cpp new file mode 100644 index 00000000000..3faf0019399 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/prefer_free_prefer.cpp @@ -0,0 +1,64 @@ +// +// cpp11/prefer_free_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> prefer(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::prefer(o1, prop<2>()); + object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>()); + object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<2> o6 = asio::prefer(o5, prop<2>()); + object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>()); + object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<2> o9 = asio::prefer(object<1>(), prop<2>()); + constexpr object<3> o10 = asio::prefer(object<1>(), prop<2>(), prop<3>()); + constexpr object<4> o11 = asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/prefer_free_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/prefer_free_require.cpp new file mode 100644 index 00000000000..f30d0fbb06f --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/prefer_free_require.cpp @@ -0,0 +1,64 @@ +// +// cpp11/prefer_free_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::prefer(o1, prop<2>()); + object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>()); + object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<2> o6 = asio::prefer(o5, prop<2>()); + object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>()); + object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<2> o9 = asio::prefer(object<1>(), prop<2>()); + constexpr object<3> o10 = asio::prefer(object<1>(), prop<2>(), prop<3>()); + constexpr object<4> o11 = asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/prefer_member_prefer.cpp b/3rdparty/asio/src/tests/properties/cpp11/prefer_member_prefer.cpp new file mode 100644 index 00000000000..9803d5e5e95 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/prefer_member_prefer.cpp @@ -0,0 +1,64 @@ +// +// cpp11/prefer_member_prefer.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> prefer(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::prefer(o1, prop<2>()); + object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>()); + object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<2> o6 = asio::prefer(o5, prop<2>()); + object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>()); + object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<2> o9 = asio::prefer(object<1>(), prop<2>()); + constexpr object<3> o10 = asio::prefer(object<1>(), prop<2>(), prop<3>()); + constexpr object<4> o11 = asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/prefer_member_require.cpp b/3rdparty/asio/src/tests/properties/cpp11/prefer_member_require.cpp new file mode 100644 index 00000000000..701fb2dec81 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/prefer_member_require.cpp @@ -0,0 +1,64 @@ +// +// cpp11/prefer_member_require.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::prefer(o1, prop<2>()); + object<3> o3 = asio::prefer(o1, prop<2>(), prop<3>()); + object<4> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<2> o6 = asio::prefer(o5, prop<2>()); + object<3> o7 = asio::prefer(o5, prop<2>(), prop<3>()); + object<4> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<2> o9 = asio::prefer(object<1>(), prop<2>()); + constexpr object<3> o10 = asio::prefer(object<1>(), prop<2>(), prop<3>()); + constexpr object<4> o11 = asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/prefer_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/prefer_static.cpp new file mode 100644 index 00000000000..18cd713d9d0 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/prefer_static.cpp @@ -0,0 +1,68 @@ +// +// cpp11/prefer_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<int N> +struct static_require<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<1> o2 = asio::prefer(o1, prop<1>()); + object<1> o3 = asio::prefer(o1, prop<1>(), prop<1>()); + object<1> o4 = asio::prefer(o1, prop<1>(), prop<1>(), prop<1>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<1> o6 = asio::prefer(o5, prop<1>()); + object<1> o7 = asio::prefer(o5, prop<1>(), prop<1>()); + object<1> o8 = asio::prefer(o5, prop<1>(), prop<1>(), prop<1>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<1> o9 = asio::prefer(object<1>(), prop<1>()); + constexpr object<1> o10 = asio::prefer(object<1>(), prop<1>(), prop<1>()); + constexpr object<1> o11 = asio::prefer(object<1>(), prop<1>(), prop<1>(), prop<1>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/prefer_unsupported.cpp b/3rdparty/asio/src/tests/properties/cpp11/prefer_unsupported.cpp new file mode 100644 index 00000000000..8eb542301ec --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/prefer_unsupported.cpp @@ -0,0 +1,59 @@ +// +// cpp11/prefer_unsupported.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/prefer.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_preferable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<1> o2 = asio::prefer(o1, prop<2>()); + object<1> o3 = asio::prefer(o1, prop<2>(), prop<3>()); + object<1> o4 = asio::prefer(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<1> o6 = asio::prefer(o5, prop<2>()); + object<1> o7 = asio::prefer(o5, prop<2>(), prop<3>()); + object<1> o8 = asio::prefer(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<1> o9 = asio::prefer(object<1>(), prop<2>()); + constexpr object<1> o10 = asio::prefer(object<1>(), prop<2>(), prop<3>()); + constexpr object<1> o11 = asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/query_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/query_free.cpp new file mode 100644 index 00000000000..17a14dc3f5a --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/query_free.cpp @@ -0,0 +1,49 @@ +// +// cpp11/query_free.cpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ + friend constexpr int query(const object&, prop) { return 123; } +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object o1 = {}; + int result1 = asio::query(o1, prop()); + assert(result1 == 123); + (void)result1; + + const object o2 = {}; + int result2 = asio::query(o2, prop()); + assert(result2 == 123); + (void)result2; + + constexpr object o3 = {}; + constexpr int result3 = asio::query(o3, prop()); + assert(result3 == 123); + (void)result3; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/query_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/query_member.cpp new file mode 100644 index 00000000000..18ea24171ab --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/query_member.cpp @@ -0,0 +1,49 @@ +// +// cpp11/query_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ + constexpr int query(prop) const { return 123; } +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object o1 = {}; + int result1 = asio::query(o1, prop()); + assert(result1 == 123); + (void)result1; + + const object o2 = {}; + int result2 = asio::query(o2, prop()); + assert(result2 == 123); + (void)result2; + + constexpr object o3 = {}; + constexpr int result3 = asio::query(o3, prop()); + assert(result3 == 123); + (void)result3; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/query_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/query_static.cpp new file mode 100644 index 00000000000..3290ab0971f --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/query_static.cpp @@ -0,0 +1,60 @@ +// +// cpp11/query_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/query.hpp" +#include <cassert> + +struct prop +{ +}; + +struct object +{ +}; + +namespace asio { + +template<> +struct is_applicable_property<object, prop> +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<> +struct static_query<object, prop> +{ + static constexpr bool is_valid = true; + static constexpr bool is_noexcept = true; + typedef int result_type; + static constexpr int value() { return 123; } +}; + +} // namespace traits +} // namespace asio + +int main() +{ + object o1 = {}; + int result1 = asio::query(o1, prop()); + assert(result1 == 123); + (void)result1; + + const object o2 = {}; + int result2 = asio::query(o2, prop()); + assert(result2 == 123); + (void)result2; + + constexpr object o3 = {}; + constexpr int result3 = asio::query(o3, prop()); + assert(result3 == 123); + (void)result3; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/require_concept_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/require_concept_free.cpp new file mode 100644 index 00000000000..3f422988d2a --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/require_concept_free.cpp @@ -0,0 +1,52 @@ +// +// cpp11/require_concept_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require_concept(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::require_concept(o1, prop<2>()); + (void)o2; + + const object<1> o3 = {}; + object<2> o4 = asio::require_concept(o3, prop<2>()); + (void)o4; + + constexpr object<2> o5 = asio::require_concept(object<1>(), prop<2>()); + (void)o5; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/require_concept_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/require_concept_member.cpp new file mode 100644 index 00000000000..1f8bbf65b42 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/require_concept_member.cpp @@ -0,0 +1,52 @@ +// +// cpp11/require_concept_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require_concept(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::require_concept(o1, prop<2>()); + (void)o2; + + const object<1> o3 = {}; + object<2> o4 = asio::require_concept(o3, prop<2>()); + (void)o4; + + constexpr object<2> o5 = asio::require_concept(object<1>(), prop<2>()); + (void)o5; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/require_concept_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/require_concept_static.cpp new file mode 100644 index 00000000000..b2a6f9dde39 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/require_concept_static.cpp @@ -0,0 +1,58 @@ +// +// cpp11/require_concept_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require_concept.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable_concept = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<int N> +struct static_require_concept<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + object<1> o1 = {}; + const object<1>& o2 = asio::require_concept(o1, prop<1>()); + assert(&o1 == &o2); + (void)o2; + + const object<1> o3 = {}; + const object<1>& o4 = asio::require_concept(o3, prop<1>()); + assert(&o3 == &o4); + (void)o4; + + constexpr object<1> o5 = asio::require_concept(object<1>(), prop<1>()); + (void)o5; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/require_free.cpp b/3rdparty/asio/src/tests/properties/cpp11/require_free.cpp new file mode 100644 index 00000000000..1acd5bc78ce --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/require_free.cpp @@ -0,0 +1,64 @@ +// +// cpp11/require_free.cpp +// ~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ + template <int N> + friend constexpr object<N> require(const object&, prop<N>) + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::require(o1, prop<2>()); + object<3> o3 = asio::require(o1, prop<2>(), prop<3>()); + object<4> o4 = asio::require(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<2> o6 = asio::require(o5, prop<2>()); + object<3> o7 = asio::require(o5, prop<2>(), prop<3>()); + object<4> o8 = asio::require(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<2> o9 = asio::require(object<1>(), prop<2>()); + constexpr object<3> o10 = asio::require(object<1>(), prop<2>(), prop<3>()); + constexpr object<4> o11 = asio::require(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/require_member.cpp b/3rdparty/asio/src/tests/properties/cpp11/require_member.cpp new file mode 100644 index 00000000000..e9192830811 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/require_member.cpp @@ -0,0 +1,64 @@ +// +// cpp11/require_member.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ + template <int N> + constexpr object<N> require(prop<N>) const + { + return object<N>(); + } +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<2> o2 = asio::require(o1, prop<2>()); + object<3> o3 = asio::require(o1, prop<2>(), prop<3>()); + object<4> o4 = asio::require(o1, prop<2>(), prop<3>(), prop<4>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<2> o6 = asio::require(o5, prop<2>()); + object<3> o7 = asio::require(o5, prop<2>(), prop<3>()); + object<4> o8 = asio::require(o5, prop<2>(), prop<3>(), prop<4>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<2> o9 = asio::require(object<1>(), prop<2>()); + constexpr object<3> o10 = asio::require(object<1>(), prop<2>(), prop<3>()); + constexpr object<4> o11 = asio::require(object<1>(), prop<2>(), prop<3>(), prop<4>()); + (void)o9; + (void)o10; + (void)o11; +} diff --git a/3rdparty/asio/src/tests/properties/cpp11/require_static.cpp b/3rdparty/asio/src/tests/properties/cpp11/require_static.cpp new file mode 100644 index 00000000000..e752dac10a4 --- /dev/null +++ b/3rdparty/asio/src/tests/properties/cpp11/require_static.cpp @@ -0,0 +1,68 @@ +// +// cpp11/require_static.cpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// +// 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) +// + +#include "asio/require.hpp" +#include <cassert> + +template <int> +struct prop +{ + static constexpr bool is_requirable = true; +}; + +template <int> +struct object +{ +}; + +namespace asio { + +template<int N, int M> +struct is_applicable_property<object<N>, prop<M> > +{ + static constexpr bool value = true; +}; + +namespace traits { + +template<int N> +struct static_require<object<N>, prop<N> > +{ + static constexpr bool is_valid = true; +}; + +} // namespace traits +} // namespace asio + +int main() +{ + object<1> o1 = {}; + object<1> o2 = asio::require(o1, prop<1>()); + object<1> o3 = asio::require(o1, prop<1>(), prop<1>()); + object<1> o4 = asio::require(o1, prop<1>(), prop<1>(), prop<1>()); + (void)o2; + (void)o3; + (void)o4; + + const object<1> o5 = {}; + object<1> o6 = asio::require(o5, prop<1>()); + object<1> o7 = asio::require(o5, prop<1>(), prop<1>()); + object<1> o8 = asio::require(o5, prop<1>(), prop<1>(), prop<1>()); + (void)o6; + (void)o7; + (void)o8; + + constexpr object<1> o9 = asio::require(object<1>(), prop<1>()); + constexpr object<1> o10 = asio::require(object<1>(), prop<1>(), prop<1>()); + constexpr object<1> o11 = asio::require(object<1>(), prop<1>(), prop<1>(), prop<1>()); + (void)o9; + (void)o10; + (void)o11; +} |