add str_concat and func_memory
This commit is contained in:
90
bin/main.cpp
90
bin/main.cpp
@@ -5,41 +5,49 @@
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
#include <type_traits>
|
||||
#include <string_view>
|
||||
|
||||
#include "string/string.hpp"
|
||||
#include "string/string_concat_helper.hpp"
|
||||
#include "range/range.hpp"
|
||||
#include "container/container.hpp"
|
||||
#include "logger/logger.hpp"
|
||||
#include "math/matrix.hpp"
|
||||
#include "math/vector.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
#include <string_view>
|
||||
// for example
|
||||
int f(int a)
|
||||
{
|
||||
hack::log()("f implementatioln");
|
||||
return ++a;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// {// ex: split_str
|
||||
// {// ex: string::split_str
|
||||
// std::string str { "asdf,qwer,zxcv" };
|
||||
// hack::string::v_str v = hack::string::split_str(str, ',');
|
||||
// for (const auto& c : v) hack::log()(c);
|
||||
// }
|
||||
//
|
||||
// {// ex: within
|
||||
// {// ex: renge::within
|
||||
// hack::log()(hack::range::within(12, 34, 12, 23, 31, 17, 22, 33));
|
||||
// }
|
||||
//
|
||||
// {// ex: vector_multiset
|
||||
// {// ex: container::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
|
||||
// {// ex: container::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;
|
||||
// }
|
||||
//
|
||||
// {// ex: log
|
||||
// {// ex: logger::log
|
||||
// hack::log()(1234, "run in main", 1234);
|
||||
// hack::warn(" # ")(1234, "run in main", 1234);
|
||||
// hack::error(" - ")(1234, "run in main", 1234);
|
||||
@@ -60,18 +68,18 @@ int main(int argc, char *argv[])
|
||||
// hack::log()(tp);
|
||||
// }
|
||||
//
|
||||
// {// ex: matches
|
||||
// {// ex: container::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
|
||||
// {// ex: container::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);
|
||||
// }
|
||||
|
||||
// {// ex: matrix
|
||||
// {// ex: math::matrix
|
||||
// hack::matrix<int, 3> m_int;
|
||||
// hack::matrix<int, 3> m_int_c { { 2, 3, 4, 123 }, { 0, 2, 4, 555 } };
|
||||
// hack::matrix<float, 3> m_float;
|
||||
@@ -85,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
// auto i = m_int[0][0][0];
|
||||
// auto f = m_float[0][0][0];
|
||||
//
|
||||
// hack::log()("m_int", i);
|
||||
// hack::log()("m_int", i);
|
||||
// hack::log()("m_float", f);
|
||||
// hack::log()("empty", m_float[123][22][33]);
|
||||
//
|
||||
@@ -100,7 +108,7 @@ int main(int argc, char *argv[])
|
||||
// m_int = std::forward<hack::matrix<int, 3>>(m_int_c);
|
||||
// hack::log("")("moved data: ", m_int);
|
||||
//
|
||||
// hack::matrix<int, 3> m_int_d = m_int;
|
||||
// hack::matrix<int, 3> m_int_d = m_int;
|
||||
// hack::log("")("copy data: ", m_int_d);
|
||||
//
|
||||
// hack::matrix<int, 3> m_int_cd { { 2, 3, 4, 3 }, { 0, 2, 4, 5 } };
|
||||
@@ -108,29 +116,43 @@ int main(int argc, char *argv[])
|
||||
// m_int_cd = m_int;
|
||||
// hack::log("")("copy data: ", m_int_cd);
|
||||
// }
|
||||
//
|
||||
// {// ex: math::vector
|
||||
// hack::vector<int, int, int> v3_1 { 8, 4, 9, };
|
||||
// hack::vector<int, int, int> v3_2 { 1, 2, 3, };
|
||||
// hack::log()(v3_1.get_value());
|
||||
// hack::log()(v3_2.get_value());
|
||||
//
|
||||
// v3_1 = v3_2;
|
||||
//
|
||||
// hack::log()(v3_1.get_value());
|
||||
// hack::log()(v3_2.get_value());
|
||||
//
|
||||
// hack::log()("length 3", v3_2.length());
|
||||
//
|
||||
// hack::vector<int, int> v2_1 { 11, 22 };
|
||||
// hack::log()("length 2", v2_1.length());
|
||||
//
|
||||
// hack::vector<int, int, int> lerp_1 { 1, 2, 3 };
|
||||
// hack::vector<int, int, int> lerp_2 { 5, 6, 7 };
|
||||
// hack::log()("lerp", lerp_1.lerp(lerp_2, 0.75f));
|
||||
//
|
||||
// auto [x, y, z] = lerp_1.get_value();
|
||||
// hack::log()("get", x, y, z);
|
||||
// hack::log()("get", lerp_1.x());
|
||||
// }
|
||||
//
|
||||
// {// ex: utils::func_memory
|
||||
// auto cach_f = hack::utils::func_memory(f);
|
||||
// hack::log()("result 1", cach_f(12));
|
||||
// hack::log()("result 2", cach_f(12));
|
||||
// }
|
||||
|
||||
{// ex: vector
|
||||
hack::vector<int, int, int> v3_1 { 8, 4, 9, };
|
||||
hack::vector<int, int, int> v3_2 { 1, 2, 3, };
|
||||
hack::log()(v3_1.get_value());
|
||||
hack::log()(v3_2.get_value());
|
||||
|
||||
v3_1 = v3_2;
|
||||
|
||||
hack::log()(v3_1.get_value());
|
||||
hack::log()(v3_2.get_value());
|
||||
|
||||
hack::log()("length 3", v3_2.length());
|
||||
|
||||
hack::vector<int, int> v2_1 { 11, 22 };
|
||||
hack::log()("length 2", v2_1.length());
|
||||
|
||||
hack::vector<int, int, int> lerp_1 { 1, 2, 3 };
|
||||
hack::vector<int, int, int> lerp_2 { 5, 6, 7 };
|
||||
hack::log()("lerp", lerp_1.lerp(lerp_2, 0.75f));
|
||||
|
||||
auto [x, y, z] = lerp_1.get_value();
|
||||
hack::log()("get", x, y, z);
|
||||
hack::log()("get", lerp_1.x());
|
||||
{// ex: string::str_concat
|
||||
std::string name = "tro";
|
||||
std::string surname = "lolo";
|
||||
const auto full_name = hack::string::str_concat + name + ", " + surname;
|
||||
hack::log()(full_name);
|
||||
hack::log()(hack::string::str_concat + "super", + "string");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user