Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Nov 15, 2024
1 parent 6a99c4f commit 0d26bcb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/tao/pq/parameter_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace tao::pq

} // namespace internal

template< typename T, typename = void >
template< typename T >
struct parameter_traits
{
static_assert( internal::dependent_false< T >, "data type T not registered as taopq parameter type" );
Expand Down
13 changes: 8 additions & 5 deletions include/tao/pq/result_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@

namespace tao::pq
{
template< typename T, typename = void >
template< typename T >
struct result_traits
{
static_assert( internal::dependent_false< T >, "data type T not registered as taopq result type" );

static auto from( const char* value ) noexcept -> T;
};

template< typename T, typename = const std::size_t >
template< typename T >
inline constexpr std::size_t result_traits_size = 1;

template< typename T >
inline constexpr std::size_t result_traits_size< T, decltype( result_traits< T >::size ) > = result_traits< T >::size;
requires requires { result_traits< T >::size; }
inline constexpr std::size_t result_traits_size< T > = result_traits< T >::size;

template<>
struct result_traits< const char* >
Expand Down Expand Up @@ -187,12 +188,14 @@ namespace tao::pq
} // namespace internal

template< typename T >
struct result_traits< T, decltype( (void)T::from_taopq ) >
requires requires { T::from_taopq; }
struct result_traits< T >
: internal::from_taopq< T, T, decltype( T::from_taopq ) >
{};

template< typename T >
struct result_traits< T, decltype( (void)bind< T >::from_taopq ) >
requires requires { bind< T >::from_taopq; }
struct result_traits< T >
: internal::from_taopq< bind< T >, T, decltype( bind< T >::from_taopq ) >
{};

Expand Down

0 comments on commit 0d26bcb

Please sign in to comment.