.. _program_listing_file__tmp_ws_src_proxsuite_include_proxsuite_linalg_veg_util_get.hpp: Program Listing for File get.hpp ================================ |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/proxsuite/include/proxsuite/linalg/veg/util/get.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef VEG_GET_HPP_QRS8GNSHS #define VEG_GET_HPP_QRS8GNSHS #include "proxsuite/linalg/veg/type_traits/core.hpp" #include "proxsuite/linalg/veg/internal/prologue.hpp" namespace proxsuite { namespace linalg { namespace veg { namespace meta { template struct is_bounded_array : false_type {}; template struct is_bounded_array : true_type {}; template struct array_extent : constant {}; template struct array_extent : constant {}; } // namespace meta namespace _detail { namespace _meta { template void get() = delete; struct array_get { template using result_type = decltype(VEG_DECLVAL(T&&)[I::value]); template VEG_INLINE static constexpr auto apply(T&& arr) VEG_NOEXCEPT->decltype(VEG_FWD(arr)[I]) { return VEG_FWD(arr)[I]; } }; struct member_get { template using result_type = decltype(VEG_DECLVAL(T&&).template get()); template VEG_INLINE static constexpr auto apply(T&& arg) VEG_DEDUCE_RET(VEG_FWD(arg).template get()); }; struct adl_get { template using result_type = decltype(get(VEG_DECLVAL(T&&))); template VEG_INLINE static constexpr auto apply(T&& arg) VEG_DEDUCE_RET(get(VEG_FWD(arg))); }; struct none_found : true_type { template using result_type = void; }; template using member_get_expr = decltype(VEG_DECLVAL(T&&).template get()); template using adl_get_expr = decltype(get(VEG_DECLVAL(T&&))); template struct has_array_get : meta::bool_constant>::value> , array_get {}; template struct has_member_get : bool_constant, T&&>)> , member_get {}; template struct has_adl_get : bool_constant, T&&>)> , adl_get {}; } // namespace _meta } // namespace _detail namespace concepts { namespace aux { VEG_DEF_CONCEPT((usize I, usize N), less_than, (I < N)); VEG_DEF_CONCEPT(typename T, bounded_array, meta::is_bounded_array::value); } // namespace aux VEG_DEF_CONCEPT_CONJUNCTION( (usize I, typename T), array_gettable, ((aux::, bounded_array>), (aux::, less_than>::value>))); VEG_DEF_CONCEPT( (usize I, typename T), member_gettable, VEG_CONCEPT( detected<_detail::_meta::member_get_expr, meta::constant, T>)); VEG_DEF_CONCEPT( (usize I, typename T), adl_gettable, VEG_CONCEPT( detected<_detail::_meta::adl_get_expr, meta::constant, T>)); VEG_DEF_CONCEPT_DISJUNCTION((usize I, typename T), gettable, ((, array_gettable), (, member_gettable), (, adl_gettable))); } // namespace concepts namespace nb { template struct get { VEG_TEMPLATE( (typename T, typename Impl = meta::disjunction<_detail::_meta::has_array_get, _detail::_meta::has_member_get, _detail::_meta::has_adl_get, _detail::_meta::none_found>), requires(VEG_CONCEPT(gettable)), VEG_INLINE constexpr auto operator(), (arg, T&&)) const VEG_NOEXCEPT_IF(VEG_IS_NOEXCEPT(Impl::template apply(VEG_FWD(arg)))) ->meta::detected_t, T> { return Impl::template apply(VEG_FWD(arg)); } }; } // namespace nb VEG_NIEBLOID_TEMPLATE(usize I, get, I); } // namespace veg } // namespace linalg } // namespace proxsuite #include "proxsuite/linalg/veg/internal/epilogue.hpp" #endif /* end of include guard VEG_GET_HPP_QRS8GNSHS */