From add6c7811ffe6e946f4b6c911f4f50e783c3ccc7 Mon Sep 17 00:00:00 2001 From: Daniel Frey Date: Fri, 15 Nov 2024 20:10:12 +0100 Subject: [PATCH] Simplify --- include/tao/pq/parameter_traits.hpp | 10 +++++----- include/tao/pq/parameter_traits_array.hpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/tao/pq/parameter_traits.hpp b/include/tao/pq/parameter_traits.hpp index 40553de..8fe3d6f 100644 --- a/include/tao/pq/parameter_traits.hpp +++ b/include/tao/pq/parameter_traits.hpp @@ -471,9 +471,8 @@ namespace tao::pq }; // default free function to detect member function to_taopq() - template< typename T > - [[nodiscard]] auto to_taopq( const T& t ) noexcept( noexcept( t.to_taopq() ) ) - -> decltype( t.to_taopq() ) + [[nodiscard]] auto to_taopq( const auto& t ) noexcept( noexcept( t.to_taopq() ) ) + requires requires { t.to_taopq(); } { return t.to_taopq(); } @@ -481,7 +480,7 @@ namespace tao::pq // default free function to detect bind::to_taopq() template< typename T > [[nodiscard]] auto to_taopq( const T& t ) noexcept( noexcept( bind< T >::to_taopq( t ) ) ) - -> decltype( bind< T >::to_taopq( t ) ) + requires requires { bind< T >::to_taopq( t ); } { return bind< T >::to_taopq( t ); } @@ -504,7 +503,8 @@ namespace tao::pq } // namespace internal template< typename T > - struct parameter_traits< T, decltype( (void)to_taopq( std::declval< const T& >() ) ) > + requires requires( const T& t ) { to_taopq( t ); } + struct parameter_traits< T > : private internal::parameter_holder< T >, public parameter_traits< typename internal::parameter_holder< T >::result_t > { diff --git a/include/tao/pq/parameter_traits_array.hpp b/include/tao/pq/parameter_traits_array.hpp index b551c68..04f45ad 100644 --- a/include/tao/pq/parameter_traits_array.hpp +++ b/include/tao/pq/parameter_traits_array.hpp @@ -74,7 +74,8 @@ namespace tao::pq } // namespace internal template< typename T > - struct parameter_traits< T, std::enable_if_t< is_array_parameter< T > > > + requires is_array_parameter< T > + struct parameter_traits< T > { private: std::string m_data;