Skip to content

Commit

Permalink
- Mark first declaration of OptionalWithFlagValue with `FASTGLTF_EX…
Browse files Browse the repository at this point in the history
…PORT`

- Remove `&&` from `transform`'s and `and_then`'s invoke_result
  • Loading branch information
n0F4x committed Aug 19, 2024
1 parent 9473693 commit e0ad451
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/fastgltf/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ namespace fastgltf {
static constexpr auto missing_value = static_cast<BufferTarget>(std::numeric_limits<std::underlying_type_t<BufferTarget>>::max());
};

template<typename T>
FASTGLTF_EXPORT template<typename T>
class OptionalWithFlagValue;

/**
Expand All @@ -1043,7 +1043,7 @@ namespace fastgltf {
* If no specialization for T of OptionalFlagValue is provided, a static assert will be triggered.
* In those cases, use std::optional or fastgltf::Optional instead.
*/
FASTGLTF_EXPORT template<typename T>
template<typename T>
class OptionalWithFlagValue final {
static_assert(!std::is_same_v<std::nullopt_t, std::remove_const_t<decltype(OptionalFlagValue<T>::missing_value)>>,
"OptionalWithFlagValue can only be used when there is an appropriate specialization of OptionalFlagValue<T>.");
Expand Down Expand Up @@ -1200,15 +1200,15 @@ namespace fastgltf {

template <typename F>
[[nodiscard]] auto and_then(F&& func)&& {
using U = std::remove_cv_t<std::remove_reference_t<std::invoke_result_t<F, T&&>>>;
using U = std::remove_cv_t<std::remove_reference_t<std::invoke_result_t<F, T>>>;
if (!has_value())
return U();
return std::invoke(std::forward<F>(func), std::move(**this));
}

template <typename F>
[[nodiscard]] auto and_then(F&& func) const&& {
using U = std::remove_cv_t<std::remove_reference_t<std::invoke_result_t<F, const T&&>>>;
using U = std::remove_cv_t<std::remove_reference_t<std::invoke_result_t<F, const T>>>;
if (!has_value())
return U();
return std::invoke(std::forward<F>(func), std::move(**this));
Expand All @@ -1232,15 +1232,15 @@ namespace fastgltf {

template <typename F>
[[nodiscard]] auto transform(F&& func)&& {
using U = std::remove_cv_t<std::invoke_result_t<F, T&&>>;
using U = std::remove_cv_t<std::invoke_result_t<F, T>>;
if (!has_value())
return Optional<U>();
return Optional<U>(std::invoke(std::forward<F>(func), std::move(**this)));
}

template <typename F>
[[nodiscard]] auto transform(F&& func) const&& {
using U = std::remove_cv_t<std::invoke_result_t<F, const T&&>>;
using U = std::remove_cv_t<std::invoke_result_t<F, const T>>;
if (!has_value())
return Optional<U>();
return Optional<U>(std::invoke(std::forward<F>(func), std::move(**this)));
Expand Down

0 comments on commit e0ad451

Please sign in to comment.