refresh struct
This commit is contained in:
25
examples/iterators/main.cpp
Normal file
25
examples/iterators/main.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user