add primary container and concepts for logger
This commit is contained in:
@@ -66,13 +66,6 @@ void example_is_sequence_container(const T& container)
|
||||
hack::log()("Sequence container with ", container.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::is_random_access_container T>
|
||||
void example_is_random_access_container(T& container)
|
||||
{
|
||||
if (!container.empty())
|
||||
hack::log()("First element: ", container[0]);
|
||||
}
|
||||
|
||||
template<hack::concepts::is_container_adapter T>
|
||||
void example_is_container_adapter(T& adapter)
|
||||
{
|
||||
@@ -139,15 +132,6 @@ void check_support(const T& value)
|
||||
hack::log()("Type is supported");
|
||||
}
|
||||
|
||||
template<hack::concepts::has_key_value_semantics T>
|
||||
void example_has_key_value_semantics(T& container)
|
||||
{
|
||||
if constexpr (hack::concepts::has_mapped_type<T>)
|
||||
hack::log()("Key-value container, sample access demonstrated");
|
||||
else
|
||||
hack::log()("Set-like container");
|
||||
}
|
||||
|
||||
template<hack::concepts::is_contiguous_container T>
|
||||
void example_is_contiguous_container(const T& container)
|
||||
{
|
||||
@@ -210,9 +194,7 @@ auto main(int argc, char *argv[]) -> int
|
||||
example_is_string(str);
|
||||
example_is_sequence_container(vec);
|
||||
example_is_sequence_container(list);
|
||||
example_is_random_access_container(vec);
|
||||
example_is_container_adapter(stack);
|
||||
example_is_associative_container(set);
|
||||
example_is_unordered_associative_container(umap);
|
||||
example_is_tuple_like(tuple);
|
||||
example_is_fixed_array(fixed_array);
|
||||
@@ -222,7 +204,6 @@ auto main(int argc, char *argv[]) -> int
|
||||
example_is_sized(vec);
|
||||
check_support(a);
|
||||
check_support(custom);
|
||||
example_has_key_value_semantics(map);
|
||||
example_is_contiguous_container(vec);
|
||||
example_can_push_front(list, 0);
|
||||
example_can_push_back(vec, 99);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <map>
|
||||
#include "hack/logger/logger.hpp"
|
||||
|
||||
@@ -9,15 +11,48 @@ auto main(int argc, char *argv[]) -> int
|
||||
double d = 2.0;
|
||||
float f = 3.f;
|
||||
std::vector<std::string> vs = { "a", "b", "c" };
|
||||
std::list<int> l = { 1, 2, 3 };
|
||||
std::deque<float> df = { 1.1f, 2.1f, 3.1f };
|
||||
std::forward_list<int> fl = { 1, 2, 3 };
|
||||
std::map<int, int> mi = { { 1, 1 }, { 2, 2 }, { 3, 3 } };
|
||||
std::multimap<int, int> mmi = { { 1, 1 }, { 1, 1 }, { 2, 2 }, { 3, 3 } };
|
||||
std::unordered_map<int, int> umi = { { 1, 1 }, { 1, 1 }, { 2, 2 }, { 3, 3 } };
|
||||
std::tuple<int, std::string, bool> tp = { 1, "asdf", false };
|
||||
std::stack<int> sti;
|
||||
sti.push(1);
|
||||
sti.push(2);
|
||||
sti.push(3);
|
||||
std::set<int> si = { 1, 2, 3 };
|
||||
std::unordered_set<int> usi = { 1, 1, 1 };
|
||||
|
||||
hack::log().set_devider(", ");
|
||||
hack::log().no_func();
|
||||
hack::log()(1, 2, 3.1f, 4.3, "asdf", "qwer", "xzcv");
|
||||
hack::log()(1, i, 3.1f, f, 4.3, d, "asdf");
|
||||
hack::log().set_devider(" = ");
|
||||
hack::log()(1, 2, 3.1f, 4.3, "asdf", "qwer", "xzcv");
|
||||
hack::log()(1, i, 3.1f, f, 4.3, d, "asdf");
|
||||
hack::log().reset();
|
||||
hack::log()(1, 2, 3.1f, 4.3, "asdf", "qwer", "xzcv");
|
||||
hack::log()(1, i, 3.1f, f, 4.3, d, "asdf");
|
||||
hack::log().set_devider(", ");
|
||||
hack::log().no_func();
|
||||
hack::log().no_file();
|
||||
hack::log().no_row();
|
||||
hack::log()(vs);
|
||||
hack::log()(l);
|
||||
hack::log()(df);
|
||||
hack::log()(fl);
|
||||
hack::log().reset();
|
||||
hack::log()(mi);
|
||||
hack::log()(mmi);
|
||||
hack::log()(umi);
|
||||
hack::log()(tp);
|
||||
hack::log()(true);
|
||||
hack::log().bool_as_number();
|
||||
hack::log()(true);
|
||||
hack::log()(si);
|
||||
hack::log()(usi);
|
||||
hack::log().reset();
|
||||
hack::log().set_devider(", ");
|
||||
hack::log()(sti, 123, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user