Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:59:19

0001 /* Traits for Outcome
0002 (C) 2018-2024 Niall Douglas <http://www.nedproductions.biz/> (8 commits)
0003 File Created: March 2018
0004 
0005 
0006 Boost Software License - Version 1.0 - August 17th, 2003
0007 
0008 Permission is hereby granted, free of charge, to any person or organization
0009 obtaining a copy of the software and accompanying documentation covered by
0010 this license (the "Software") to use, reproduce, display, distribute,
0011 execute, and transmit the Software, and to prepare derivative works of the
0012 Software, and to permit third-parties to whom the Software is furnished to
0013 do so, all subject to the following:
0014 
0015 The copyright notices in the Software and this entire statement, including
0016 the above license grant, this restriction and the following disclaimer,
0017 must be included in all copies of the Software, in whole or in part, and
0018 all derivative works of the Software, unless such copies or derivative
0019 works are solely in the form of machine-executable object code generated by
0020 a source language processor.
0021 
0022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0023 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0024 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
0025 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
0026 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
0027 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0028 DEALINGS IN THE SOFTWARE.
0029 */
0030 
0031 #ifndef BOOST_OUTCOME_TRAIT_HPP
0032 #define BOOST_OUTCOME_TRAIT_HPP
0033 
0034 #include "config.hpp"
0035 
0036 BOOST_OUTCOME_V2_NAMESPACE_EXPORT_BEGIN
0037 
0038 namespace trait
0039 {
0040   /*! AWAITING HUGO JSON CONVERSION TOOL
0041 SIGNATURE NOT RECOGNISED
0042 */
0043   template <class R>                                                             //
0044   static constexpr bool type_can_be_used_in_basic_result =                       //
0045   (!std::is_reference<R>::value                                                  //
0046    && !BOOST_OUTCOME_V2_NAMESPACE::detail::is_in_place_type_t<std::decay_t<R>>::value  //
0047    && !is_success_type<R>                                                        //
0048    && !is_failure_type<R>                                                        //
0049    && !std::is_array<R>::value                                                   //
0050    && (std::is_void<R>::value || (std::is_object<R>::value                       //
0051                                   && std::is_destructible<R>::value))            //
0052   );
0053 
0054   /*! AWAITING HUGO JSON CONVERSION TOOL
0055 type definition  is_error_type. Potential doc page: NOT FOUND
0056 */
0057   template <class T> struct is_move_bitcopying
0058   {
0059     static constexpr bool value = false;
0060   };
0061 
0062   /*! AWAITING HUGO JSON CONVERSION TOOL
0063 type definition  is_error_type. Potential doc page: NOT FOUND
0064 */
0065   template <class E> struct is_error_type
0066   {
0067     static constexpr bool value = false;
0068   };
0069 
0070   /*! AWAITING HUGO JSON CONVERSION TOOL
0071 type definition  is_error_type_enum. Potential doc page: NOT FOUND
0072 */
0073   template <class E, class Enum> struct is_error_type_enum
0074   {
0075     static constexpr bool value = false;
0076   };
0077 
0078   namespace detail
0079   {
0080     template <class T> using devoid = BOOST_OUTCOME_V2_NAMESPACE::detail::devoid<T>;
0081     template <class T> std::add_rvalue_reference_t<devoid<T>> declval() noexcept;
0082 
0083     // From http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4436.pdf
0084     namespace detector_impl
0085     {
0086       template <class...> using void_t = void;
0087       template <class Default, class, template <class...> class Op, class... Args> struct detector
0088       {
0089         static constexpr bool value = false;
0090         using type = Default;
0091       };
0092       template <class Default, template <class...> class Op, class... Args> struct detector<Default, void_t<Op<Args...>>, Op, Args...>
0093       {
0094         static constexpr bool value = true;
0095         using type = Op<Args...>;
0096       };
0097     }  // namespace detector_impl
0098     template <template <class...> class Op, class... Args> using is_detected = detector_impl::detector<void, void, Op, Args...>;
0099 
0100     template <class Arg> using result_of_make_error_code = decltype(make_error_code(declval<Arg>()));
0101     template <class Arg> using introspect_make_error_code = is_detected<result_of_make_error_code, Arg>;
0102 
0103     template <class Arg> using result_of_make_exception_ptr = decltype(make_exception_ptr(declval<Arg>()));
0104     template <class Arg> using introspect_make_exception_ptr = is_detected<result_of_make_exception_ptr, Arg>;
0105 
0106     template <class T> struct _is_error_code_available
0107     {
0108       static constexpr bool value = detail::introspect_make_error_code<T>::value;
0109       using type = typename detail::introspect_make_error_code<T>::type;
0110     };
0111     template <class T> struct _is_exception_ptr_available
0112     {
0113       static constexpr bool value = detail::introspect_make_exception_ptr<T>::value;
0114       using type = typename detail::introspect_make_exception_ptr<T>::type;
0115     };
0116   }  // namespace detail
0117 
0118   /*! AWAITING HUGO JSON CONVERSION TOOL
0119 type definition  is_error_code_available. Potential doc page: NOT FOUND
0120 */
0121   template <class T> struct is_error_code_available
0122   {
0123     static constexpr bool value = detail::_is_error_code_available<std::decay_t<T>>::value;
0124     using type = typename detail::_is_error_code_available<std::decay_t<T>>::type;
0125   };
0126   template <class T> constexpr bool is_error_code_available_v = detail::_is_error_code_available<std::decay_t<T>>::value;
0127 
0128   /*! AWAITING HUGO JSON CONVERSION TOOL
0129 type definition  is_exception_ptr_available. Potential doc page: NOT FOUND
0130 */
0131   template <class T> struct is_exception_ptr_available
0132   {
0133     static constexpr bool value = detail::_is_exception_ptr_available<std::decay_t<T>>::value;
0134     using type = typename detail::_is_exception_ptr_available<std::decay_t<T>>::type;
0135   };
0136   template <class T> constexpr bool is_exception_ptr_available_v = detail::_is_exception_ptr_available<std::decay_t<T>>::value;
0137 
0138 
0139 }  // namespace trait
0140 
0141 BOOST_OUTCOME_V2_NAMESPACE_END
0142 
0143 #endif