rebuild project

This commit is contained in:
chatlanin 2022-03-27 22:23:36 +03:00
parent 13d2fdcf38
commit bde4398888
14 changed files with 137 additions and 253 deletions

View File

@ -25,128 +25,128 @@ int f(int a)
int main(int argc, char *argv[])
{
// {// 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: renge::within
// hack::log()(hack::range::within(12, 34, 12, 23, 31, 17, 22, 33));
// }
//
// {// 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: 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: logger::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);
//
// std::tuple<int, std::string, bool> tp { 1, "tuple test", false };
// hack::log()(tp);
// }
//
// {// 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: 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: 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: 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;
//
// m_int[0][0][0] = 123;
// m_int[0][0][1] = 23;
// m_int[0][0][2] = 43;
// m_int_c[0][0][0] = 123;
// m_float[0][0][0] = 123.123;
//
// auto i = m_int[0][0][0];
// auto f = m_float[0][0][0];
//
// hack::log()("m_int", i);
// hack::log()("m_float", f);
// hack::log()("empty", m_float[123][22][33]);
//
// hack::log("")("compare (true): ", m_int == m_int_c);
// hack::log("")("compare (false): ", m_int == m_float);
// hack::log("")(m_int);
// hack::log("")(m_int_c);
//
// auto m_moved {std::forward<hack::matrix<int, 3>>(m_int_c)};
// hack::log("")("moved data: ", m_moved);
//
// 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::log("")("copy data: ", m_int_d);
//
// hack::matrix<int, 3> m_int_cd { { 2, 3, 4, 3 }, { 0, 2, 4, 5 } };
// hack::log("")("copy data: ", m_int_cd);
// 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: renge::within
hack::log()(hack::range::within(12, 34, 12, 23, 31, 17, 22, 33));
}
{// 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: 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: logger::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);
std::tuple<int, std::string, bool> tp { 1, "tuple test", false };
hack::log()(tp);
}
{// 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: 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: 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;
m_int[0][0][0] = 123;
m_int[0][0][1] = 23;
m_int[0][0][2] = 43;
m_int_c[0][0][0] = 123;
m_float[0][0][0] = 123.123;
auto i = m_int[0][0][0];
auto f = m_float[0][0][0];
hack::log()("m_int", i);
hack::log()("m_float", f);
hack::log()("empty", m_float[123][22][33]);
hack::log("")("compare (true): ", m_int == m_int_c);
hack::log("")("compare (false): ", m_int == m_float);
hack::log("")(m_int);
hack::log("")(m_int_c);
auto m_moved {std::forward<hack::matrix<int, 3>>(m_int_c)};
hack::log("")("moved data: ", m_moved);
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::log("")("copy data: ", m_int_d);
hack::matrix<int, 3> m_int_cd { { 2, 3, 4, 3 }, { 0, 2, 4, 5 } };
hack::log("")("copy data: ", m_int_cd);
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: string::str_concat
std::string name = "tro";

View File

@ -1,11 +1,4 @@
deps += view_dep
deps += concepts_dep
deps += utils_dep
deps += iterators_dep
deps += string_dep
deps += range_dep
deps += container_dep
deps += logger_dep
deps += hack_dep
executable(
'hack', 'main.cpp',

View File

@ -24,21 +24,7 @@ endif
args = []
deps = []
inc = []
inc += include_directories('.')
conf = configuration_data()
check_headers = [
['ncurses.h', 'HAVE_NCURSES_H'],
['curses.h', 'HAVE_CURSES_H'],
]
foreach h : check_headers
if compiler.has_header(h.get(0))
conf.set(h.get(1), 1)
endif
endforeach
subdir('src')
subdir('bin')

View File

@ -1,13 +0,0 @@
headers = ['concepts.hpp']
sources = []
lib = library(
'concepts',
include_directories : inc,
sources: [headers, sources]
)
concepts_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,5 +0,0 @@
#include "container.hpp"
namespace hack::container
{
}

View File

@ -1,13 +0,0 @@
headers = ['container.hpp']
sources = ['container.cpp']
lib = library(
'container',
include_directories : inc,
sources: [headers, sources]
)
container_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,13 +0,0 @@
headers = ['sequence_ostream_iterator.hpp', 'associative_ostream_iterator.hpp']
sources = []
lib = library(
'iterators',
include_directories : inc,
sources: [headers, sources]
)
iterators_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,13 +0,0 @@
headers = ['vector.hpp', 'matrix.hpp']
sources = []
lib = library(
'math',
include_directories : inc,
sources: [headers, sources]
)
math_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,11 +1,17 @@
inc += include_directories('.')
subdir('view')
subdir('concepts')
subdir('utils')
subdir('iterators')
subdir('string')
subdir('range')
subdir('container')
subdir('logger')
subdir('math')
deps += string_dep
deps += logger_dep
lib = library(
'hack',
include_directories : inc,
)
hack_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,13 +0,0 @@
headers = ['range.hpp']
sources = ['range.cpp']
lib = library(
'range',
include_directories : inc,
sources: [headers, sources]
)
range_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,5 +0,0 @@
#include "range.hpp"
namespace hack::renge
{
}

View File

@ -1,13 +0,0 @@
headers = ['utils.hpp']
sources = []
lib = library(
'utils',
include_directories : inc,
sources: [headers, sources]
)
utils_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -1,13 +0,0 @@
headers = ['color.hpp']
sources = []
lib = library(
'view',
include_directories : inc,
sources: [headers, sources]
)
view_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@ -15,7 +15,7 @@ test(
executable(
'within',
'range.cpp',
dependencies: [ range_dep, gtest_dep ]
dependencies: [ hack_dep, gtest_dep ]
)
)
@ -24,6 +24,6 @@ test(
executable(
'container',
'container.cpp',
dependencies: [ range_dep, gtest_dep ]
dependencies: [ hack_dep, gtest_dep ]
)
)