hack/sandbox/bin/iterators/main.cpp
2024-05-15 18:52:32 +03:00

26 lines
581 B
C++

#include <set>
#include "hack/logger/logger.hpp"
#include "hack/iterators/associative_ostream_iterator.hpp"
#include "hack/concepts/concepts.hpp"
template<hack::concepts::is_map T>
static void print_t(const T& data)
{
std::cout << "{";
std::copy(data.cbegin(), data.cend(), hack::iterators::associative_ostream_iterator<typename T::value_type>(data.size(), std::cout));
std::cout << "}";
}
auto main(int argc, char *argv[]) -> int
{
std::map<std::string, int> m { { "a", 1 }, { "b", 2 } };
for (auto& [key, value] : m)
hack::log()(key, value);
print_t(m);
}