2022-03-01 12:03:12 +03:00
|
|
|
#include <iostream>
|
|
|
|
|
2022-03-20 22:01:41 +03:00
|
|
|
#include <map>
|
2022-03-21 10:42:52 +03:00
|
|
|
#include <set>
|
2022-03-20 22:01:41 +03:00
|
|
|
#include <vector>
|
|
|
|
|
2022-03-01 12:03:12 +03:00
|
|
|
#include "string/string.hpp"
|
2022-03-02 11:08:14 +03:00
|
|
|
#include "range/range.hpp"
|
2022-03-02 12:11:21 +03:00
|
|
|
#include "container/container.hpp"
|
2022-03-20 22:01:41 +03:00
|
|
|
#include "logger/logger.hpp"
|
2022-02-28 12:44:18 +03:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2022-03-21 10:42:52 +03:00
|
|
|
{// ex: split_str
|
|
|
|
std::string str { "asdf,qwer,zxcv" };
|
|
|
|
hack::string::v_str v = hack::string::split_str(str, ',');
|
|
|
|
for (const auto& c : v) std::cout << c << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
{// ex: within
|
|
|
|
std::cout << std::boolalpha << hack::range::within(12, 34, 12, 23, 31, 17, 22, 33) << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
{// ex: vector_multiset
|
|
|
|
std::vector<std::string> v;
|
|
|
|
hack::container::vector_multiset(v, "asdf", "qwer", "zcv");
|
|
|
|
for(const auto& c : v) std::cout << c << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
{// ex: set_multiset
|
|
|
|
std::set<int> s;
|
|
|
|
hack::container::set_multiset(s, 1, 2, 3, 3, 2, 1);
|
|
|
|
for(const auto& c : s) std::cout << c << std::endl;
|
|
|
|
}
|
2022-03-01 12:03:12 +03:00
|
|
|
|
2022-03-20 22:01:41 +03:00
|
|
|
{// ex: log
|
|
|
|
hack::log()(1234, "run in main", 1234);
|
|
|
|
hack::warn(" # ")(1234, "run in main", 1234);
|
|
|
|
hack::error(" - ")(1234, "run in main", 1234);
|
|
|
|
|
|
|
|
std::string str { "hi" };
|
|
|
|
hack::log()(str);
|
|
|
|
|
|
|
|
std::vector<std::string> vs { "asdf", "qwer", "zxcv" };
|
|
|
|
hack::log()("vector", vs, 1, 2, 'a');
|
|
|
|
|
|
|
|
std::list<std::string> ls { "asdf", "qwer", "zxcv" };
|
|
|
|
hack::log()(vs, ls);
|
|
|
|
|
|
|
|
std::map<int, std::string> m { { 1, "asdf" }, { 2, "qwer" }, { 3, "zxcv" } };
|
|
|
|
hack::log()(vs, ls, m);
|
2022-03-03 12:15:10 +03:00
|
|
|
|
2022-03-20 22:01:41 +03:00
|
|
|
std::tuple<int, std::string, bool> tp { 1, "tuple test", false };
|
|
|
|
hack::log()(tp);
|
2022-03-03 12:15:10 +03:00
|
|
|
}
|
2022-03-21 10:42:52 +03:00
|
|
|
|
|
|
|
{// ex: matches
|
|
|
|
std::vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
|
|
|
hack::log()(hack::container::matches(v, 2, 5, 4, 12));
|
|
|
|
}
|
|
|
|
|
|
|
|
{// ex: vector_remove_at
|
|
|
|
std::vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
|
|
|
hack::container::vector_remove_at(v, 3);
|
|
|
|
hack::log()(v);
|
|
|
|
}
|
2022-02-28 12:44:18 +03:00
|
|
|
}
|