add is_unordered_set concept
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "hack/logger/logger.hpp"
|
||||
#include "hack/concepts/concepts.hpp"
|
||||
@@ -15,6 +16,12 @@ void test_associative(const T& m)
|
||||
hack::log()("is associative", m);
|
||||
}
|
||||
|
||||
template<hack::concepts::is_unordered_set T>
|
||||
void test_unordered_set(const T& m)
|
||||
{
|
||||
hack::log()("is unordered set", m);
|
||||
}
|
||||
|
||||
auto main(int argc, char *argv[]) -> int
|
||||
{
|
||||
std::map<std::string, int> m { { "a", 1 }, { "b", 2 } };
|
||||
@@ -26,6 +33,10 @@ auto main(int argc, char *argv[]) -> int
|
||||
|
||||
std::vector<int> v { 1, 2, 3 };
|
||||
// test_associative(v); error !!!
|
||||
|
||||
std::unordered_set<int> us { 1, 2, 3 };
|
||||
test_unordered_set(us);
|
||||
test_associative(us);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "hack/logger/logger.hpp"
|
||||
|
||||
@@ -9,6 +10,8 @@ auto main(int argc, char *argv[]) -> int
|
||||
|
||||
std::vector<int> v { 1, 2, 3 };
|
||||
hack::log()(v, s);
|
||||
|
||||
std::unordered_set<int> us { 1, 2, 3 };
|
||||
|
||||
hack::log()(v, s, us);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
executable(
|
||||
'hack',
|
||||
'utils/main.cpp',
|
||||
'logger/main.cpp',
|
||||
dependencies : deps,
|
||||
cpp_args: args,
|
||||
include_directories : inc
|
||||
|
||||
Reference in New Issue
Block a user