start logger impl
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "hack/concepts/concepts.hpp"
|
||||
#include "hack/logger/logger.hpp"
|
||||
|
||||
template<hack::concepts::modern::has_value_type T>
|
||||
template<hack::concepts::has_value_type T>
|
||||
void example_has_value_type(const T& container)
|
||||
{
|
||||
/*
|
||||
@@ -16,37 +16,37 @@ void example_has_value_type(const T& container)
|
||||
hack::log()("Value type: ", typeid(typename T::value_type).name());
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_key_type T>
|
||||
template<hack::concepts::has_key_type T>
|
||||
void example_has_key_type(const T& container)
|
||||
{
|
||||
hack::log()("Key type: ", typeid(typename T::key_type).name());
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_mapped_type T>
|
||||
template<hack::concepts::has_mapped_type T>
|
||||
void example_has_mapped_type(const T& container)
|
||||
{
|
||||
hack::log()("Mapped type: ", typeid(typename T::mapped_type).name());
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_iterator T>
|
||||
template<hack::concepts::has_iterator T>
|
||||
void example_has_iterator(const T& container)
|
||||
{
|
||||
hack::log()("Container is iterable, size: ", std::distance(container.begin(), container.end()));
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_size T>
|
||||
template<hack::concepts::has_size T>
|
||||
void example_has_size(const T& container)
|
||||
{
|
||||
hack::log()("Container size:", container.size());
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_key_compare T>
|
||||
template<hack::concepts::has_key_compare T>
|
||||
void example_has_key_compare(const T& container)
|
||||
{
|
||||
hack::log()("Key compare type: ", typeid(typename T::key_compare).name());
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_allocator_type T>
|
||||
template<hack::concepts::has_allocator_type T>
|
||||
void example_has_allocator_type(const T& container)
|
||||
{
|
||||
// Можно получить аллокатор из контейнера
|
||||
@@ -54,77 +54,77 @@ void example_has_allocator_type(const T& container)
|
||||
hack::log()("Allocator obtained successfully");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_string T>
|
||||
template<hack::concepts::is_string T>
|
||||
void example_is_string(const T& str)
|
||||
{
|
||||
hack::log()("String content: ", str, " (length: ", str.length(), ")");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_sequence_container T>
|
||||
template<hack::concepts::is_sequence_container T>
|
||||
void example_is_sequence_container(const T& container)
|
||||
{
|
||||
hack::log()("Sequence container with ", container.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_random_access_container T>
|
||||
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::modern::is_container_adapter T>
|
||||
template<hack::concepts::is_container_adapter T>
|
||||
void example_is_container_adapter(T& adapter)
|
||||
{
|
||||
hack::log()("Container adapter with ", adapter.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_associative_container T>
|
||||
template<hack::concepts::is_associative_container T>
|
||||
void example_is_associative_container(const T& container)
|
||||
{
|
||||
hack::log()("Associative container with ", container.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_unordered_associative_container T>
|
||||
template<hack::concepts::is_unordered_associative_container T>
|
||||
void example_is_unordered_associative_container(const T& container)
|
||||
{
|
||||
hack::log()("Unordered associative container with ", container.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_tuple_like T>
|
||||
template<hack::concepts::is_tuple_like T>
|
||||
void example_is_tuple_like(const T& tuple)
|
||||
{
|
||||
hack::log()("Tuple-like with ", std::tuple_size_v<T>, " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_fixed_array T>
|
||||
template<hack::concepts::is_fixed_array T>
|
||||
void example_is_fixed_array(const T& array)
|
||||
{
|
||||
hack::log()("Fixed array with ", std::extent_v<T>, " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_std_array T>
|
||||
template<hack::concepts::is_std_array T>
|
||||
void example_is_std_array(const T& array)
|
||||
{
|
||||
hack::log()("std::array with ", array.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_any_container T>
|
||||
template<hack::concepts::is_any_container T>
|
||||
void example_is_any_container(const T& container)
|
||||
{
|
||||
hack::log()("Any container with ", container.size(), " elements");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_iterable T>
|
||||
template<hack::concepts::is_iterable T>
|
||||
void example_is_iterable(const T& iterable)
|
||||
{
|
||||
hack::log()("Iterable object");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::is_sized T>
|
||||
template<hack::concepts::is_sized T>
|
||||
void example_is_sized(const T& sized)
|
||||
{
|
||||
if constexpr (hack::concepts::modern::has_size<T>)
|
||||
if constexpr (hack::concepts::has_size<T>)
|
||||
hack::log()("Sized object: ", sized.size(), " elements");
|
||||
else
|
||||
hack::log()("Sized object (compile-time size)");
|
||||
@@ -133,29 +133,29 @@ void example_is_sized(const T& sized)
|
||||
template<typename T>
|
||||
void check_support(const T& value)
|
||||
{
|
||||
if constexpr (hack::concepts::modern::not_supported<T>)
|
||||
if constexpr (hack::concepts::not_supported<T>)
|
||||
hack::log()("Type is NOT supported by this library");
|
||||
else
|
||||
hack::log()("Type is supported");
|
||||
}
|
||||
|
||||
template<hack::concepts::modern::has_key_value_semantics T>
|
||||
template<hack::concepts::has_key_value_semantics T>
|
||||
void example_has_key_value_semantics(T& container)
|
||||
{
|
||||
if constexpr (hack::concepts::modern::has_mapped_type<T>)
|
||||
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::modern::is_contiguous_container T>
|
||||
template<hack::concepts::is_contiguous_container T>
|
||||
void example_is_contiguous_container(const T& container)
|
||||
{
|
||||
hack::log()("Contiguous memory container");
|
||||
}
|
||||
|
||||
template<typename Container, typename Value>
|
||||
requires hack::concepts::modern::can_push_front<Container, Value>
|
||||
requires hack::concepts::can_push_front<Container, Value>
|
||||
void example_can_push_front(Container& container, Value&& value)
|
||||
{
|
||||
container.push_front(std::forward<Value>(value));
|
||||
@@ -163,7 +163,7 @@ void example_can_push_front(Container& container, Value&& value)
|
||||
}
|
||||
|
||||
template<typename Container, typename Value>
|
||||
requires hack::concepts::modern::can_push_back<Container, Value>
|
||||
requires hack::concepts::can_push_back<Container, Value>
|
||||
void example_can_push_back(Container& container, Value&& value)
|
||||
{
|
||||
container.push_back(std::forward<Value>(value));
|
||||
@@ -171,7 +171,7 @@ void example_can_push_back(Container& container, Value&& value)
|
||||
}
|
||||
|
||||
template<typename Container, typename Key>
|
||||
requires hack::concepts::modern::can_find<Container, Key>
|
||||
requires hack::concepts::can_find<Container, Key>
|
||||
void example_can_find(Container& container, Key&& key)
|
||||
{
|
||||
auto it = container.find(std::forward<Key>(key));
|
||||
|
||||
Reference in New Issue
Block a user