Skip to content

Commit

Permalink
Add branchless trait specialization for std::identity (issue #130)
Browse files Browse the repository at this point in the history
  • Loading branch information
Morwenn committed Nov 9, 2020
1 parent 6b00048 commit 3428fb4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/cpp-sort/utility/branchless_traits.h
Expand Up @@ -10,6 +10,7 @@
////////////////////////////////////////////////////////////
#include <functional>
#include <type_traits>
#include "../detail/config.h"
#include "../detail/type_traits.h"

namespace cppsort
Expand Down Expand Up @@ -83,6 +84,13 @@ namespace utility
struct is_probably_branchless_projection_impl:
std::is_member_object_pointer<Projection>
{};

#if CPPSORT_STD_IDENTITY_AVAILABLE
template<typename T>
struct is_probably_branchless_projection_impl<std::identity, T>:
std::true_type
{};
#endif
}

// Strip types from cv and reference qualifications if needed
Expand Down

0 comments on commit 3428fb4

Please sign in to comment.