Skip to content

Commit

Permalink
Make constexpr precede explicit consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Nov 2, 2024
1 parent e3d3b24 commit 8523dba
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ template <typename Char = char> class parse_context {
using char_type = Char;
using iterator = const Char*;

explicit constexpr parse_context(basic_string_view<Char> fmt,
constexpr explicit parse_context(basic_string_view<Char> fmt,
int next_arg_id = 0)
: fmt_(fmt), next_arg_id_(next_arg_id) {}

Expand Down Expand Up @@ -1191,7 +1191,7 @@ class compile_parse_context : public parse_context<Char> {
using base = parse_context<Char>;

public:
explicit FMT_CONSTEXPR compile_parse_context(basic_string_view<Char> fmt,
FMT_CONSTEXPR explicit compile_parse_context(basic_string_view<Char> fmt,
int num_args, const type* types,
int next_arg_id = 0)
: base(fmt, next_arg_id), num_args_(num_args), types_(types) {}
Expand Down Expand Up @@ -1647,7 +1647,7 @@ class format_string_checker {

public:
template <typename... T>
explicit FMT_CONSTEXPR format_string_checker(basic_string_view<Char> fmt,
FMT_CONSTEXPR explicit format_string_checker(basic_string_view<Char> fmt,
arg_pack<T...>)
: types_{mapped_type_constant<T, Char>::value...},
named_args_{},
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct is_compiled_string : std::is_base_of<compiled_string, S> {};
template <typename Char, size_t N, fmt::detail::fixed_string<Char, N> Str>
struct udl_compiled_string : compiled_string {
using char_type = Char;
explicit constexpr operator basic_string_view<char_type>() const {
constexpr explicit operator basic_string_view<char_type>() const {
return {Str.data, N - 1};
}
};
Expand Down
12 changes: 6 additions & 6 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -4039,16 +4039,16 @@ class format_int {
}

public:
explicit FMT_CONSTEXPR20 format_int(int value) : str_(format_signed(value)) {}
explicit FMT_CONSTEXPR20 format_int(long value)
FMT_CONSTEXPR20 explicit format_int(int value) : str_(format_signed(value)) {}
FMT_CONSTEXPR20 explicit format_int(long value)
: str_(format_signed(value)) {}
explicit FMT_CONSTEXPR20 format_int(long long value)
FMT_CONSTEXPR20 explicit format_int(long long value)
: str_(format_signed(value)) {}
explicit FMT_CONSTEXPR20 format_int(unsigned value)
FMT_CONSTEXPR20 explicit format_int(unsigned value)
: str_(format_unsigned(value)) {}
explicit FMT_CONSTEXPR20 format_int(unsigned long value)
FMT_CONSTEXPR20 explicit format_int(unsigned long value)
: str_(format_unsigned(value)) {}
explicit FMT_CONSTEXPR20 format_int(unsigned long long value)
FMT_CONSTEXPR20 explicit format_int(unsigned long long value)
: str_(format_unsigned(value)) {}

/// Returns the number of characters written to the output buffer.
Expand Down
4 changes: 2 additions & 2 deletions test/format-impl-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ struct double_double {
double a;
double b;

explicit constexpr double_double(double a_val = 0, double b_val = 0)
constexpr explicit double_double(double a_val = 0, double b_val = 0)
: a(a_val), b(b_val) {}

operator double() const { return a + b; }
Expand All @@ -299,7 +299,7 @@ bool operator>=(const double_double& lhs, const double_double& rhs) {
struct slow_float {
float value;

explicit constexpr slow_float(float val = 0) : value(val) {}
constexpr explicit slow_float(float val = 0) : value(val) {}
operator float() const { return value; }
auto operator-() const -> slow_float { return slow_float(-value); }
};
Expand Down
4 changes: 2 additions & 2 deletions test/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class scan_parse_context {
public:
using iterator = string_view::iterator;

explicit FMT_CONSTEXPR scan_parse_context(string_view format)
FMT_CONSTEXPR explicit scan_parse_context(string_view format)
: format_(format) {}

FMT_CONSTEXPR auto begin() const -> iterator { return format_.begin(); }
Expand Down Expand Up @@ -347,7 +347,7 @@ class scan_context {
using iterator = detail::scan_iterator;
using sentinel = detail::scan_sentinel;

explicit FMT_CONSTEXPR scan_context(detail::scan_buffer& buf, scan_args args)
FMT_CONSTEXPR explicit scan_context(detail::scan_buffer& buf, scan_args args)
: buf_(buf), args_(args) {}

FMT_CONSTEXPR auto arg(int id) const -> scan_arg {
Expand Down

0 comments on commit 8523dba

Please sign in to comment.