Skip to content

Commit

Permalink
Add inline keyword to some member functions
Browse files Browse the repository at this point in the history
When using modules, non-template constructors and member functions defined in-class are not "inline"by default.

This is generally a good thing, but in our particular case we have a few one-line forwarding functions that we would actually like to make available for inlining.
  • Loading branch information
tcbrindle committed Jul 31, 2023
1 parent 1864f09 commit 7ce991e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions include/flux/core/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace flux {

FLUX_EXPORT
struct unrecoverable_error : std::logic_error {
explicit unrecoverable_error(char const* msg) : std::logic_error(msg) {}
explicit inline unrecoverable_error(char const* msg) : std::logic_error(msg) {}
};

namespace detail {
Expand Down Expand Up @@ -50,7 +50,7 @@ FLUX_EXPORT inline constexpr auto runtime_error = detail::runtime_error_fn{};
namespace detail {

struct assert_fn {
constexpr void operator()(bool cond, char const* msg,
inline constexpr void operator()(bool cond, char const* msg,
std::source_location loc = std::source_location::current()) const
{
if (cond) {
Expand All @@ -62,7 +62,7 @@ struct assert_fn {
};

struct bounds_check_fn {
constexpr void operator()(bool cond, std::source_location loc = std::source_location::current()) const
inline constexpr void operator()(bool cond, std::source_location loc = std::source_location::current()) const
{
if (!std::is_constant_evaluated()) {
assert_fn{}(cond, "out of bounds sequence access", std::move(loc));
Expand Down
10 changes: 5 additions & 5 deletions include/flux/source/iota.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct iota_sequence : inline_sequence_base<iota_sequence<T>> {
static constexpr iota_traits traits{.has_start = true, .has_end = false};

public:
constexpr explicit iota_sequence(T from)
inline constexpr explicit iota_sequence(T from)
: start_(std::move(from))
{}

Expand All @@ -144,7 +144,7 @@ struct bounded_iota_sequence : inline_sequence_base<bounded_iota_sequence<T>> {
static constexpr iota_traits traits{.has_start = true, .has_end = true};

public:
constexpr bounded_iota_sequence(T from, T to)
inline constexpr bounded_iota_sequence(T from, T to)
: start_(std::move(from)),
end_(std::move(to))
{}
Expand All @@ -168,17 +168,17 @@ struct iota_fn {
};

struct ints_fn {
constexpr auto operator()() const
inline constexpr auto operator()() const
{
return basic_iota_sequence<distance_t>();
}

constexpr auto operator()(distance_t from) const
inline constexpr auto operator()(distance_t from) const
{
return iota_sequence<distance_t>(from);
}

constexpr auto operator()(distance_t from, distance_t to) const
inline constexpr auto operator()(distance_t from, distance_t to) const
{
return bounded_iota_sequence<distance_t>(from, to);
}
Expand Down

0 comments on commit 7ce991e

Please sign in to comment.