Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:28

0001 //
0002 // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/url
0008 //
0009 
0010 #ifndef BOOST_URL_GRAMMAR_TYPE_TRAITS_HPP
0011 #define BOOST_URL_GRAMMAR_TYPE_TRAITS_HPP
0012 
0013 #include <boost/url/detail/config.hpp>
0014 #include <boost/url/error_types.hpp>
0015 #include <type_traits>
0016 
0017 namespace boost {
0018 namespace urls {
0019 namespace grammar {
0020 
0021 /** Determine if T meets the requirements of Rule
0022 
0023     This is an alias for `std::true_type` if
0024     `T` meets the requirements, otherwise it
0025     is an alias for `std::false_type`.
0026 
0027     @par Example
0028     @code
0029     struct U
0030     {
0031         struct value_type;
0032 
0033         auto
0034         parse(
0035             char const*& it,
0036             char const* end) const ->
0037                 system::result<value_type>
0038     };
0039 
0040     static_assert( is_rule<U>::value, "Requirements not met" );
0041     @endcode
0042 
0043     @see
0044         @ref parse.
0045 */
0046 #ifdef BOOST_URL_DOCS
0047 template<class T>
0048 using is_rule = __see_below__;
0049 #else
0050 template<class T, class = void>
0051 struct is_rule : std::false_type {};
0052 
0053 template<class T>
0054 struct is_rule<T, void_t<decltype(
0055     std::declval<system::result<typename T::value_type>&>() =
0056         std::declval<T const&>().parse(
0057             std::declval<char const*&>(),
0058             std::declval<char const*>())
0059     )>> : std::is_nothrow_copy_constructible<T>
0060 {
0061 };
0062 #endif
0063 
0064 } // grammar
0065 } // urls
0066 } // boost
0067 
0068 #endif