rebuild project
This commit is contained in:
parent
13d2fdcf38
commit
bde4398888
242
bin/main.cpp
242
bin/main.cpp
@ -25,128 +25,128 @@ int f(int a)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// {// ex: string::split_str
|
{// ex: string::split_str
|
||||||
// std::string str { "asdf,qwer,zxcv" };
|
std::string str { "asdf,qwer,zxcv" };
|
||||||
// hack::string::v_str v = hack::string::split_str(str, ',');
|
hack::string::v_str v = hack::string::split_str(str, ',');
|
||||||
// for (const auto& c : v) hack::log()(c);
|
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: math::matrix
|
{// ex: renge::within
|
||||||
// hack::matrix<int, 3> m_int;
|
hack::log()(hack::range::within(12, 34, 12, 23, 31, 17, 22, 33));
|
||||||
// hack::matrix<int, 3> m_int_c { { 2, 3, 4, 123 }, { 0, 2, 4, 555 } };
|
}
|
||||||
// hack::matrix<float, 3> m_float;
|
|
||||||
//
|
{// ex: container::vector_multiset
|
||||||
// m_int[0][0][0] = 123;
|
std::vector<std::string> v;
|
||||||
// m_int[0][0][1] = 23;
|
hack::container::vector_multiset(v, "asdf", "qwer", "zcv");
|
||||||
// m_int[0][0][2] = 43;
|
for(const auto& c : v) std::cout << c << std::endl;
|
||||||
// m_int_c[0][0][0] = 123;
|
}
|
||||||
// m_float[0][0][0] = 123.123;
|
|
||||||
//
|
{// ex: container::set_multiset
|
||||||
// auto i = m_int[0][0][0];
|
std::set<int> s;
|
||||||
// auto f = m_float[0][0][0];
|
hack::container::set_multiset(s, 1, 2, 3, 3, 2, 1);
|
||||||
//
|
for(const auto& c : s) std::cout << c << std::endl;
|
||||||
// hack::log()("m_int", i);
|
}
|
||||||
// hack::log()("m_float", f);
|
|
||||||
// hack::log()("empty", m_float[123][22][33]);
|
{// ex: logger::log
|
||||||
//
|
hack::log()(1234, "run in main", 1234);
|
||||||
// hack::log("")("compare (true): ", m_int == m_int_c);
|
hack::warn(" # ")(1234, "run in main", 1234);
|
||||||
// hack::log("")("compare (false): ", m_int == m_float);
|
hack::error(" - ")(1234, "run in main", 1234);
|
||||||
// hack::log("")(m_int);
|
|
||||||
// hack::log("")(m_int_c);
|
std::string str { "hi" };
|
||||||
//
|
hack::log()(str);
|
||||||
// auto m_moved {std::forward<hack::matrix<int, 3>>(m_int_c)};
|
|
||||||
// hack::log("")("moved data: ", m_moved);
|
std::vector<std::string> vs { "asdf", "qwer", "zxcv" };
|
||||||
//
|
hack::log()("vector", vs, 1, 2, 'a');
|
||||||
// m_int = std::forward<hack::matrix<int, 3>>(m_int_c);
|
|
||||||
// hack::log("")("moved data: ", m_int);
|
std::list<std::string> ls { "asdf", "qwer", "zxcv" };
|
||||||
//
|
hack::log()(vs, ls);
|
||||||
// hack::matrix<int, 3> m_int_d = m_int;
|
|
||||||
// hack::log("")("copy data: ", m_int_d);
|
std::map<int, std::string> m { { 1, "asdf" }, { 2, "qwer" }, { 3, "zxcv" } };
|
||||||
//
|
hack::log()(vs, ls, m);
|
||||||
// hack::matrix<int, 3> m_int_cd { { 2, 3, 4, 3 }, { 0, 2, 4, 5 } };
|
|
||||||
// hack::log("")("copy data: ", m_int_cd);
|
std::tuple<int, std::string, bool> tp { 1, "tuple test", false };
|
||||||
// m_int_cd = m_int;
|
hack::log()(tp);
|
||||||
// hack::log("")("copy data: ", m_int_cd);
|
}
|
||||||
// }
|
|
||||||
//
|
{// ex: container::matches
|
||||||
// {// ex: math::vector
|
std::vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||||
// hack::vector<int, int, int> v3_1 { 8, 4, 9, };
|
hack::log()(hack::container::matches(v, 2, 5, 4, 12));
|
||||||
// hack::vector<int, int, int> v3_2 { 1, 2, 3, };
|
}
|
||||||
// hack::log()(v3_1.get_value());
|
|
||||||
// hack::log()(v3_2.get_value());
|
{// ex: container::vector_remove_at
|
||||||
//
|
std::vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||||
// v3_1 = v3_2;
|
hack::container::vector_remove_at(v, 3);
|
||||||
//
|
hack::log()(v);
|
||||||
// hack::log()(v3_1.get_value());
|
}
|
||||||
// hack::log()(v3_2.get_value());
|
|
||||||
//
|
{// ex: math::matrix
|
||||||
// hack::log()("length 3", v3_2.length());
|
hack::matrix<int, 3> m_int;
|
||||||
//
|
hack::matrix<int, 3> m_int_c { { 2, 3, 4, 123 }, { 0, 2, 4, 555 } };
|
||||||
// hack::vector<int, int> v2_1 { 11, 22 };
|
hack::matrix<float, 3> m_float;
|
||||||
// hack::log()("length 2", v2_1.length());
|
|
||||||
//
|
m_int[0][0][0] = 123;
|
||||||
// hack::vector<int, int, int> lerp_1 { 1, 2, 3 };
|
m_int[0][0][1] = 23;
|
||||||
// hack::vector<int, int, int> lerp_2 { 5, 6, 7 };
|
m_int[0][0][2] = 43;
|
||||||
// hack::log()("lerp", lerp_1.lerp(lerp_2, 0.75f));
|
m_int_c[0][0][0] = 123;
|
||||||
//
|
m_float[0][0][0] = 123.123;
|
||||||
// auto [x, y, z] = lerp_1.get_value();
|
|
||||||
// hack::log()("get", x, y, z);
|
auto i = m_int[0][0][0];
|
||||||
// hack::log()("get", lerp_1.x());
|
auto f = m_float[0][0][0];
|
||||||
// }
|
|
||||||
//
|
hack::log()("m_int", i);
|
||||||
// {// ex: utils::func_memory
|
hack::log()("m_float", f);
|
||||||
// auto cach_f = hack::utils::func_memory(f);
|
hack::log()("empty", m_float[123][22][33]);
|
||||||
// hack::log()("result 1", cach_f(12));
|
|
||||||
// hack::log()("result 2", cach_f(12));
|
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
|
{// ex: string::str_concat
|
||||||
std::string name = "tro";
|
std::string name = "tro";
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
deps += view_dep
|
deps += hack_dep
|
||||||
deps += concepts_dep
|
|
||||||
deps += utils_dep
|
|
||||||
deps += iterators_dep
|
|
||||||
deps += string_dep
|
|
||||||
deps += range_dep
|
|
||||||
deps += container_dep
|
|
||||||
deps += logger_dep
|
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
'hack', 'main.cpp',
|
'hack', 'main.cpp',
|
||||||
|
14
meson.build
14
meson.build
@ -24,21 +24,7 @@ endif
|
|||||||
|
|
||||||
args = []
|
args = []
|
||||||
deps = []
|
deps = []
|
||||||
|
|
||||||
inc = []
|
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('src')
|
||||||
subdir('bin')
|
subdir('bin')
|
||||||
|
@ -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
|
|
||||||
)
|
|
@ -1,5 +0,0 @@
|
|||||||
#include "container.hpp"
|
|
||||||
|
|
||||||
namespace hack::container
|
|
||||||
{
|
|
||||||
}
|
|
@ -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
|
|
||||||
)
|
|
@ -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
|
|
||||||
)
|
|
@ -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
|
|
||||||
)
|
|
@ -1,11 +1,17 @@
|
|||||||
inc += include_directories('.')
|
inc += include_directories('.')
|
||||||
|
|
||||||
subdir('view')
|
|
||||||
subdir('concepts')
|
|
||||||
subdir('utils')
|
|
||||||
subdir('iterators')
|
|
||||||
subdir('string')
|
subdir('string')
|
||||||
subdir('range')
|
|
||||||
subdir('container')
|
|
||||||
subdir('logger')
|
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
|
||||||
|
)
|
||||||
|
@ -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
|
|
||||||
)
|
|
@ -1,5 +0,0 @@
|
|||||||
#include "range.hpp"
|
|
||||||
|
|
||||||
namespace hack::renge
|
|
||||||
{
|
|
||||||
}
|
|
@ -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
|
|
||||||
)
|
|
@ -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
|
|
||||||
)
|
|
@ -15,7 +15,7 @@ test(
|
|||||||
executable(
|
executable(
|
||||||
'within',
|
'within',
|
||||||
'range.cpp',
|
'range.cpp',
|
||||||
dependencies: [ range_dep, gtest_dep ]
|
dependencies: [ hack_dep, gtest_dep ]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,6 +24,6 @@ test(
|
|||||||
executable(
|
executable(
|
||||||
'container',
|
'container',
|
||||||
'container.cpp',
|
'container.cpp',
|
||||||
dependencies: [ range_dep, gtest_dep ]
|
dependencies: [ hack_dep, gtest_dep ]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user