Created
January 17, 2018 07:29
-
-
Save btaczala/4c0e7a78126040a9f3843c4c5057b128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template <std::size_t... Args> | |
struct IsSorted; | |
template <std::size_t index, std::size_t next, std::size_t... Args> | |
struct IsSorted<index, next, Args...> { | |
constexpr static const bool sorted = | |
index < next && IsSorted<next, Args...>::sorted; | |
}; | |
template <std::size_t almostLast, std::size_t last> | |
struct IsSorted<almostLast, last> { | |
constexpr static const bool sorted = almostLast < last; | |
}; | |
template <std::size_t... Args> | |
struct Numbers { | |
constexpr static const bool is_sorted = true; | |
}; | |
int main(int argc, char *argv[]) { Numbers<1, 2, 3> nums; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment