repo_name
stringclasses 10
values | file_path
stringlengths 29
222
| content
stringlengths 24
926k
| extention
stringclasses 5
values |
---|---|---|---|
asio | data/projects/asio/test/properties/cpp03/can_require_concept_member.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable_concept = true;
};
template <int>
struct object
{
template <int N>
object<N> require_concept(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_concept_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_require_concept<object<1>, prop<2> >::value));
assert((boost::asio::can_require_concept<const object<1>, prop<2> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_static.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_prefer<object<1>, prop<1> >::value));
assert((boost::asio::can_prefer<object<1>, prop<1>, prop<1> >::value));
assert((boost::asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<1> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<1>, prop<1> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_query_unsupported.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
namespace asio {
template <>
struct is_applicable_property<object, prop>
{
static const bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_query<object, prop>::value));
assert((!boost::asio::can_query<const object, prop>::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_preferable_unsupported.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = false;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_applicable_free_require.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct require_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/prefer_member_prefer.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
object<N> prefer(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct prefer_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_applicable_static.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_applicable_member_prefer.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
object<N> prefer(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct prefer_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_preferable_member_prefer.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = false;
};
template <int>
struct object
{
template <int N>
object<N> prefer(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct prefer_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_free_require.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_not_applicable_static.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_require<object<1>, prop<1> >::value));
assert((!boost::asio::can_require<object<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_require<object<1>, prop<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_require<const object<1>, prop<1> >::value));
assert((!boost::asio::can_require<const object<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_require<const object<1>, prop<1>, prop<1>, prop<1> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_static.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_require<object<1>, prop<1> >::value));
assert((boost::asio::can_require<object<1>, prop<1>, prop<1> >::value));
assert((boost::asio::can_require<object<1>, prop<1>, prop<1>, prop<1> >::value));
assert((boost::asio::can_require<const object<1>, prop<1> >::value));
assert((boost::asio::can_require<const object<1>, prop<1>, prop<1> >::value));
assert((boost::asio::can_require<const object<1>, prop<1>, prop<1>, prop<1> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_applicable_member_require.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
object<N> require(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct require_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_preferable_free_prefer.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = false;
};
template <int>
struct object
{
template <int N>
friend object<N> prefer(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct prefer_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/query_static.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static const bool value = true;
};
namespace traits {
template<>
struct static_query<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
static int value() { return 123; }
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object o1 = {};
int result1 = boost::asio::query(o1, prop());
assert(result1 == 123);
(void)result1;
const object o2 = {};
int result2 = boost::asio::query(o2, prop());
assert(result2 == 123);
(void)result2;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_member_require.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
object<N> require(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_concept_not_applicable_member.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable_concept = true;
};
template <int>
struct object
{
template <int N>
object<N> require_concept(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct require_concept_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_require_concept<object<1>, prop<2> >::value));
assert((!boost::asio::can_require_concept<const object<1>, prop<2> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/require_concept_static.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable_concept = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require_concept<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
const object<1>& o2 = boost::asio::require_concept(o1, prop<1>());
assert(&o1 == &o2);
(void)o2;
const object<1> o3 = {};
const object<1>& o4 = boost::asio::require_concept(o3, prop<1>());
assert(&o3 == &o4);
(void)o4;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_applicable_unsupported.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
};
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_query_member.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
int query(prop) const { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static const bool value = true;
};
namespace traits {
template<>
struct query_member<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_query<object, prop>::value));
assert((boost::asio::can_query<const object, prop>::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_member.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
template <int N>
object<N> require(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_require<object<1>, prop<2> >::value));
assert((boost::asio::can_require<object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((boost::asio::can_require<const object<1>, prop<2> >::value));
assert((boost::asio::can_require<const object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_free.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_require<object<1>, prop<2> >::value));
assert((boost::asio::can_require<object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((boost::asio::can_require<const object<1>, prop<2> >::value));
assert((boost::asio::can_require<const object<1>, prop<2>, prop<3> >::value));
assert((boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_not_applicable_unsupported.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
int main()
{
assert((!boost::asio::can_require<object<1>, prop<2> >::value));
assert((!boost::asio::can_require<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/query_free.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
friend int query(const object&, prop) { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static const bool value = true;
};
namespace traits {
template<>
struct query_free<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object o1 = {};
int result1 = boost::asio::query(o1, prop());
assert(result1 == 123);
(void)result1;
const object o2 = {};
int result2 = boost::asio::query(o2, prop());
assert(result2 == 123);
(void)result2;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_concept_not_applicable_free.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable_concept = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require_concept(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct require_concept_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_require_concept<object<1>, prop<2> >::value));
assert((!boost::asio::can_require_concept<const object<1>, prop<2> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_concept_static.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable_concept = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require_concept<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_require_concept<object<1>, prop<1> >::value));
assert((boost::asio::can_require_concept<const object<1>, prop<1> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/require_concept_free.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable_concept = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require_concept(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_concept_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::require_concept(o1, prop<2>());
(void)o2;
const object<1> o3 = {};
object<2> o4 = boost::asio::require_concept(o3, prop<2>());
(void)o4;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_query_static.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static const bool value = true;
};
namespace traits {
template<>
struct static_query<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
static int value() { return 123; }
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_query<object, prop>::value));
assert((boost::asio::can_query<const object, prop>::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_not_applicable_free.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct require_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_require<object<1>, prop<2> >::value));
assert((!boost::asio::can_require<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_applicable_free_prefer.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> prefer(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
namespace traits {
template<int N, int M>
struct prefer_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_query_free.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
friend int query(const object&, prop) { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static const bool value = true;
};
namespace traits {
template<>
struct query_free<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((boost::asio::can_query<object, prop>::value));
assert((boost::asio::can_query<const object, prop>::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_query_not_applicable_static.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
namespace asio {
namespace traits {
template<>
struct static_query<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
static int value() { return 123; }
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_query<object, prop>::value));
assert((!boost::asio::can_query<const object, prop>::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/require_static.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<1> o2 = boost::asio::require(o1, prop<1>());
object<1> o3 = boost::asio::require(o1, prop<1>(), prop<1>());
object<1> o4 = boost::asio::require(o1, prop<1>(), prop<1>(), prop<1>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<1> o6 = boost::asio::require(o5, prop<1>());
object<1> o7 = boost::asio::require(o5, prop<1>(), prop<1>());
object<1> o8 = boost::asio::require(o5, prop<1>(), prop<1>(), prop<1>());
(void)o6;
(void)o7;
(void)o8;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/require_free.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_requirable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> require(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::require(o1, prop<2>());
object<3> o3 = boost::asio::require(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::require(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::require(o5, prop<2>());
object<3> o7 = boost::asio::require(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::require(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_concept_not_applicable_unsupported.cpp | //
// cpp03/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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
int main()
{
assert((!boost::asio::can_require_concept<object<1>, prop<2> >::value));
assert((!boost::asio::can_require_concept<const object<1>, prop<2> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/prefer_static.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<1> o2 = boost::asio::prefer(o1, prop<1>());
object<1> o3 = boost::asio::prefer(o1, prop<1>(), prop<1>());
object<1> o4 = boost::asio::prefer(o1, prop<1>(), prop<1>(), prop<1>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<1> o6 = boost::asio::prefer(o5, prop<1>());
object<1> o7 = boost::asio::prefer(o5, prop<1>(), prop<1>());
object<1> o8 = boost::asio::prefer(o5, prop<1>(), prop<1>(), prop<1>());
(void)o6;
(void)o7;
(void)o8;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/prefer_unsupported.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
const object<1>& o2 = boost::asio::prefer(o1, prop<1>());
assert(&o1 == &o2);
(void)o2;
const object<1> o3 = {};
const object<1>& o4 = boost::asio::prefer(o3, prop<1>());
assert(&o3 == &o4);
(void)o4;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_preferable_static.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = false;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static const bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<1>, prop<1> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/prefer_member_require.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
object<N> require(prop<N>) const
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_member<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/prefer_free_prefer.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = true;
};
template <int>
struct object
{
template <int N>
friend object<N> prefer(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct prefer_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_query_not_applicable_free.cpp | //
// cpp03/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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
friend int query(const object&, prop) { return 123; }
};
namespace boost {
namespace asio {
namespace traits {
template<>
struct query_free<object, prop>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef int result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_query<object, prop>::value));
assert((!boost::asio::can_query<const object, prop>::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_require_unsupported.cpp | //
// cpp03/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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_require<object<1>, prop<2> >::value));
assert((!boost::asio::can_require<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp03/can_prefer_not_preferable_free_require.cpp | //
// cpp03/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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static const bool is_preferable = false;
};
template <int>
struct object
{
template <int N>
friend object<N> require(const object&, prop<N>)
{
return object<N>();
}
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static const bool value = true;
};
namespace traits {
template<int N, int M>
struct require_free<object<N>, prop<M> >
{
static const bool is_valid = true;
static const bool is_noexcept = true;
typedef object<M> result_type;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
assert((!boost::asio::can_prefer<object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3> >::value));
assert((!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4> >::value));
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_preferable_member_require.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_free.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/require_member.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::require(o1, prop<2>());
object<3> o3 = boost::asio::require(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::require(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::require(o5, prop<2>());
object<3> o7 = boost::asio::require(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::require(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<2> o9 = boost::asio::require(object<1>(), prop<2>());
constexpr object<3> o10 = boost::asio::require(object<1>(), prop<2>(), prop<3>());
constexpr object<4> o11 = boost::asio::require(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_not_applicable_unsupported.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
int main()
{
static_assert(!boost::asio::can_query<object, prop>::value, "");
static_assert(!boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/prefer_free_require.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<2> o9 = boost::asio::prefer(object<1>(), prop<2>());
constexpr object<3> o10 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>());
constexpr object<4> o11 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_not_applicable_member.cpp | //
// 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 <boost/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(!boost::asio::can_require<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/require_concept_member.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::require_concept(o1, prop<2>());
(void)o2;
const object<1> o3 = {};
object<2> o4 = boost::asio::require_concept(o3, prop<2>());
(void)o4;
constexpr object<2> o5 = boost::asio::require_concept(object<1>(), prop<2>());
(void)o5;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_unsupported.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_member_prefer.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_not_applicable_static.cpp | //
// 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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_requirable_concept = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
static_assert(!boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/query_member.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
constexpr int query(prop) const { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object o1 = {};
int result1 = boost::asio::query(o1, prop());
assert(result1 == 123);
(void)result1;
const object o2 = {};
int result2 = boost::asio::query(o2, prop());
assert(result2 == 123);
(void)result2;
constexpr object o3 = {};
constexpr int result3 = boost::asio::query(o3, prop());
assert(result3 == 123);
(void)result3;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_not_applicable_member.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
constexpr int query(prop) const { return 123; }
};
int main()
{
static_assert(!boost::asio::can_query<object, prop>::value, "");
static_assert(!boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_free_prefer.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_unsupported.cpp | //
// 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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_member.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_static.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
static_assert(boost::asio::can_prefer<object<1>, prop<1>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<1>, prop<1>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<1>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_unsupported.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_query<object, prop>::value, "");
static_assert(!boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_preferable_unsupported.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = false;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_applicable_free_require.cpp | //
// 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 <boost/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(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/prefer_member_prefer.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<2> o9 = boost::asio::prefer(object<1>(), prop<2>());
constexpr object<3> o10 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>());
constexpr object<4> o11 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_applicable_static.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static constexpr bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_applicable_member_prefer.cpp | //
// 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 <boost/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(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_preferable_member_prefer.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_free_require.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_not_applicable_static.cpp | //
// 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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_requirable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
namespace traits {
template<int N>
struct static_require<object<N>, prop<N> >
{
static constexpr bool is_valid = true;
};
} // namespace traits
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_require<object<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_static.cpp | //
// 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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_requirable = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
static_assert(boost::asio::can_require<object<1>, prop<1>>::value, "");
static_assert(boost::asio::can_require<object<1>, prop<1>, prop<1>>::value, "");
static_assert(boost::asio::can_require<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<1>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<1>, prop<1>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_applicable_member_require.cpp | //
// 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 <boost/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(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_preferable_free_prefer.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/query_static.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
object o1 = {};
int result1 = boost::asio::query(o1, prop());
assert(result1 == 123);
(void)result1;
const object o2 = {};
int result2 = boost::asio::query(o2, prop());
assert(result2 == 123);
(void)result2;
constexpr object o3 = {};
constexpr int result3 = boost::asio::query(o3, prop());
assert(result3 == 123);
(void)result3;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_member_require.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_not_applicable_member.cpp | //
// 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 <boost/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(!boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/require_concept_static.cpp | //
// 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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_requirable_concept = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
object<1> o1 = {};
const object<1>& o2 = boost::asio::require_concept(o1, prop<1>());
assert(&o1 == &o2);
(void)o2;
const object<1> o3 = {};
const object<1>& o4 = boost::asio::require_concept(o3, prop<1>());
assert(&o3 == &o4);
(void)o4;
constexpr object<1> o5 = boost::asio::require_concept(object<1>(), prop<1>());
(void)o5;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_applicable_unsupported.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = true;
};
template <int>
struct object
{
};
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_member.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
constexpr int query(prop) const { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_query<object, prop>::value, "");
static_assert(boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_member.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_require<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_require<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_free.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_require<object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_require<object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<2>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_not_applicable_unsupported.cpp | //
// 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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
int main()
{
static_assert(!boost::asio::can_require<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/query_free.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
friend constexpr int query(const object&, prop) { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object o1 = {};
int result1 = boost::asio::query(o1, prop());
assert(result1 == 123);
(void)result1;
const object o2 = {};
int result2 = boost::asio::query(o2, prop());
assert(result2 == 123);
(void)result2;
constexpr object o3 = {};
constexpr int result3 = boost::asio::query(o3, prop());
assert(result3 == 123);
(void)result3;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_not_applicable_free.cpp | //
// 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 <boost/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(!boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_static.cpp | //
// 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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_requirable_concept = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
static_assert(boost::asio::can_require_concept<object<1>, prop<1>>::value, "");
static_assert(boost::asio::can_require_concept<const object<1>, prop<1>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/require_concept_free.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::require_concept(o1, prop<2>());
(void)o2;
const object<1> o3 = {};
object<2> o4 = boost::asio::require_concept(o3, prop<2>());
(void)o4;
constexpr object<2> o5 = boost::asio::require_concept(object<1>(), prop<2>());
(void)o5;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_static.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
static_assert(boost::asio::can_query<object, prop>::value, "");
static_assert(boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_not_applicable_free.cpp | //
// 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 <boost/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(!boost::asio::can_require<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_applicable_free_prefer.cpp | //
// 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 <boost/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(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_free.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
friend constexpr int query(const object&, prop) { return 123; }
};
namespace boost {
namespace asio {
template<>
struct is_applicable_property<object, prop>
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(boost::asio::can_query<object, prop>::value, "");
static_assert(boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_not_applicable_static.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
static_assert(!boost::asio::can_query<object, prop>::value, "");
static_assert(!boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/require_static.cpp | //
// 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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_requirable = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
object<1> o1 = {};
object<1> o2 = boost::asio::require(o1, prop<1>());
object<1> o3 = boost::asio::require(o1, prop<1>(), prop<1>());
object<1> o4 = boost::asio::require(o1, prop<1>(), prop<1>(), prop<1>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<1> o6 = boost::asio::require(o5, prop<1>());
object<1> o7 = boost::asio::require(o5, prop<1>(), prop<1>());
object<1> o8 = boost::asio::require(o5, prop<1>(), prop<1>(), prop<1>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<1> o9 = boost::asio::require(object<1>(), prop<1>());
constexpr object<1> o10 = boost::asio::require(object<1>(), prop<1>(), prop<1>());
constexpr object<1> o11 = boost::asio::require(object<1>(), prop<1>(), prop<1>(), prop<1>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/require_free.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::require(o1, prop<2>());
object<3> o3 = boost::asio::require(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::require(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::require(o5, prop<2>());
object<3> o7 = boost::asio::require(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::require(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<2> o9 = boost::asio::require(object<1>(), prop<2>());
constexpr object<3> o10 = boost::asio::require(object<1>(), prop<2>(), prop<3>());
constexpr object<4> o11 = boost::asio::require(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_concept_not_applicable_unsupported.cpp | //
// 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 <boost/asio/require_concept.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
int main()
{
static_assert(!boost::asio::can_require_concept<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require_concept<const object<1>, prop<2>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/prefer_static.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
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
} // namespace boost
int main()
{
object<1> o1 = {};
object<1> o2 = boost::asio::prefer(o1, prop<1>());
object<1> o3 = boost::asio::prefer(o1, prop<1>(), prop<1>());
object<1> o4 = boost::asio::prefer(o1, prop<1>(), prop<1>(), prop<1>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<1> o6 = boost::asio::prefer(o5, prop<1>());
object<1> o7 = boost::asio::prefer(o5, prop<1>(), prop<1>());
object<1> o8 = boost::asio::prefer(o5, prop<1>(), prop<1>(), prop<1>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<1> o9 = boost::asio::prefer(object<1>(), prop<1>());
constexpr object<1> o10 = boost::asio::prefer(object<1>(), prop<1>(), prop<1>());
constexpr object<1> o11 = boost::asio::prefer(object<1>(), prop<1>(), prop<1>(), prop<1>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/prefer_unsupported.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = true;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<1> o2 = boost::asio::prefer(o1, prop<2>());
object<1> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<1> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<1> o6 = boost::asio::prefer(o5, prop<2>());
object<1> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<1> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<1> o9 = boost::asio::prefer(object<1>(), prop<2>());
constexpr object<1> o10 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>());
constexpr object<1> o11 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_preferable_static.cpp | //
// 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 <boost/asio/prefer.hpp>
#include <cassert>
template <int>
struct prop
{
static constexpr bool is_preferable = false;
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<1>, prop<1>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<1>, prop<1>, prop<1>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/prefer_member_require.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<2> o9 = boost::asio::prefer(object<1>(), prop<2>());
constexpr object<3> o10 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>());
constexpr object<4> o11 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/prefer_free_prefer.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
object<1> o1 = {};
object<2> o2 = boost::asio::prefer(o1, prop<2>());
object<3> o3 = boost::asio::prefer(o1, prop<2>(), prop<3>());
object<4> o4 = boost::asio::prefer(o1, prop<2>(), prop<3>(), prop<4>());
(void)o2;
(void)o3;
(void)o4;
const object<1> o5 = {};
object<2> o6 = boost::asio::prefer(o5, prop<2>());
object<3> o7 = boost::asio::prefer(o5, prop<2>(), prop<3>());
object<4> o8 = boost::asio::prefer(o5, prop<2>(), prop<3>(), prop<4>());
(void)o6;
(void)o7;
(void)o8;
constexpr object<2> o9 = boost::asio::prefer(object<1>(), prop<2>());
constexpr object<3> o10 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>());
constexpr object<4> o11 = boost::asio::prefer(object<1>(), prop<2>(), prop<3>(), prop<4>());
(void)o9;
(void)o10;
(void)o11;
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_query_not_applicable_free.cpp | //
// 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 <boost/asio/query.hpp>
#include <cassert>
struct prop
{
};
struct object
{
friend constexpr int query(const object&, prop) { return 123; }
};
int main()
{
static_assert(!boost::asio::can_query<object, prop>::value, "");
static_assert(!boost::asio::can_query<const object, prop>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_require_unsupported.cpp | //
// 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 <boost/asio/require.hpp>
#include <cassert>
template <int>
struct prop
{
};
template <int>
struct object
{
};
namespace boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_require<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_require<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
asio | data/projects/asio/test/properties/cpp11/can_prefer_not_preferable_free_require.cpp | //
// 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 <boost/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 boost {
namespace asio {
template<int N, int M>
struct is_applicable_property<object<N>, prop<M> >
{
static constexpr bool value = true;
};
} // namespace asio
} // namespace boost
int main()
{
static_assert(!boost::asio::can_prefer<object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<object<1>, prop<2>, prop<3>, prop<4>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>>::value, "");
static_assert(!boost::asio::can_prefer<const object<1>, prop<2>, prop<3>, prop<4>>::value, "");
}
| cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.