Skip to content

Commit

Permalink
Format.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtv committed Sep 30, 2021
1 parent b4b8935 commit 3790e4e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
3 changes: 2 additions & 1 deletion config-tests/concepts.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include <vector>


template<typename T> concept Foo = std::ranges::input_range<T>;
template<typename T>
concept Foo = std::ranges::input_range<T>;


template<Foo F> auto foo(F const &r)
Expand Down
10 changes: 4 additions & 6 deletions include/pqxx/connection.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,12 @@ concept ZKey_ZValues = std::ranges::input_range<T> and requires(T t)
{std::cbegin(t)};
{
std::get<0>(*std::cbegin(t))
}
->ZString;
} -> ZString;
{
std::get<1>(*std::cbegin(t))
}
->ZString;
}
and std::tuple_size_v<typename std::ranges::iterator_t<T>::value_type> == 2;
} -> ZString;
} and std::tuple_size_v<typename std::ranges::iterator_t<T>::value_type>
== 2;
#endif // PQXX_HAVE_CONCEPTS
} // namespace pqxx::internal

Expand Down
4 changes: 2 additions & 2 deletions include/pqxx/strconv.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ template<typename TYPE> inline constexpr format param_format(TYPE const &)
* we can reference them by a pointer.
*/
template<class TYPE>
concept binary = std::ranges::contiguous_range<TYPE>
and std::is_same_v<strip_t<value_type<TYPE>>, std::byte>;
concept binary = std::ranges::contiguous_range<TYPE> and
std::is_same_v<strip_t<value_type<TYPE>>, std::byte>;
#endif
//@}
} // namespace pqxx
Expand Down
7 changes: 4 additions & 3 deletions include/pqxx/types.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ using value_type = decltype(*std::begin(std::declval<CONTAINER>()));
#if defined(PQXX_HAVE_CONCEPTS)
/// Concept: Any type that we can read as a string of @c char.
template<typename STRING>
concept char_string = std::ranges::contiguous_range<STRING>
and std::same_as<strip_t<value_type<STRING>>, char>;
concept char_string = std::ranges::contiguous_range<STRING> and
std::same_as < strip_t<value_type<STRING>>,
char > ;

/// Concept: Anything we can iterate to get things we can read as strings.
template<typename RANGE>
Expand All @@ -118,7 +119,7 @@ concept char_strings =
/// Concept: Anything we might want to treat as binary data.
template<typename DATA>
concept potential_binary = std::ranges::contiguous_range<DATA> and
(sizeof(value_type<DATA>) == 1);
(sizeof(value_type<DATA>) == 1);
#endif // PQXX_HAVE_CONCEPTS


Expand Down
3 changes: 2 additions & 1 deletion include/pqxx/util.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ std::basic_string_view<std::byte> binary_cast(TYPE const &data)


#if defined(PQXX_HAVE_CONCEPTS)
template<typename CHAR> concept char_sized = (sizeof(CHAR) == 1);
template<typename CHAR>
concept char_sized = (sizeof(CHAR) == 1);
# define PQXX_CHAR_SIZED_ARG char_sized
#else
# define PQXX_CHAR_SIZED_ARG typename
Expand Down
6 changes: 3 additions & 3 deletions include/pqxx/zview.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ namespace pqxx::internal
* support each of these individually.
*/
template<typename T>
concept ZString = std::is_convertible_v<strip_t<T>, char const *> or
std::is_convertible_v<strip_t<T>, zview> or
std::is_convertible_v<T, std::string const &>;
concept ZString = std::is_convertible_v < strip_t<T>,
char const * > or std::is_convertible_v<strip_t<T>, zview> or
std::is_convertible_v<T, std::string const &>;
} // namespace pqxx::internal
#endif // PQXX_HAVE_CONCEPTS

Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_connection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ std::size_t length(char const str[])
template<typename MAP> void test_params_type()
{
#if defined(PQXX_HAVE_CONCEPTS)
using item_t = std::remove_reference_t<decltype(
*std::declval<std::ranges::iterator_t<MAP>>())>;
using item_t = std::remove_reference_t<
decltype(*std::declval<std::ranges::iterator_t<MAP>>())>;
using key_t = decltype(std::get<0>(std::declval<item_t>()));
using value_t = decltype(std::get<1>(std::declval<item_t>()));

Expand Down

0 comments on commit 3790e4e

Please sign in to comment.