Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed GNU compiler warnings #45

Merged
merged 1 commit into from
Feb 2, 2023
Merged

Fixed GNU compiler warnings #45

merged 1 commit into from
Feb 2, 2023

Conversation

jnyfah
Copy link
Contributor

@jnyfah jnyfah commented Feb 1, 2023

  • returning with std::move has no effect as some is already a temporary object

STX/include/stx/option.h

Lines 666 to 670 in 822cf2a

constexpr auto take() -> Option {
if (is_some()) {
Some some = std::move(some_);
storage::assign(None);
return std::move(some);

  • using decltype((void)) serves the same purpose of indicating that the type T has an operator() member function.

STX/include/stx/fn.h

Lines 173 to 174 in 822cf2a

struct is_functor_impl<T, decltype(&T::operator(), (void)0)>
: public std::true_type {};

  • No need to have an empty if block

STX/include/stx/vec.h

Lines 23 to 25 in 822cf2a

if constexpr (std::is_trivially_destructible_v<T>) {
} else {
for (T& element : Span<T>{start, size}) {

@lamarrr
Copy link
Owner

lamarrr commented Feb 2, 2023

LGTM. Thanks for your contribution! 😄

@lamarrr lamarrr merged commit de0f924 into lamarrr:main Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants