add new examples

This commit is contained in:
chatlanin
2023-08-14 11:02:39 +03:00
parent 0339df9279
commit 1242044571
25 changed files with 442 additions and 446 deletions

31
bin/concepts/main.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include <set>
#include "hack/logger/logger.hpp"
#include "hack/concepts/concepts.hpp"
template<hack::concepts::is_map T>
void test_map(const T& m)
{
hack::log()("is map", m);
}
template<hack::concepts::is_associative_container T>
void test_associative(const T& m)
{
hack::log()("is associative", m);
}
auto main(int argc, char *argv[]) -> int
{
std::map<std::string, int> m { { "a", 1 }, { "b", 2 } };
test_map(m);
test_associative(m);
auto t = std::make_tuple("a", 1, "b", 2);
test_associative(t);
std::vector<int> v { 1, 2, 3 };
// test_associative(v); error !!!
}