A library of highly specialized STL-compliant containers and algorithms, such as compile-time heterogenous type containers, ARM Neon register strings, or stack memory allocators.
#include<iostream>
#include<tiger/type_map.hpp>structA { autoread() -> int { return1; } };
structB { autoread() -> int { return2; } };
structC { autoread() -> int { return2; } };
intmain() {
tgr::tmap map(A{}, B{}, C{});
// Access value by type -- O(1)
std::cout << tgr::tmap_get<A>(map).read() << '\n';
// Iterate over all types without dynamic dispatch -- O(n)tgr::for_each(map, [](auto& value) { std::cout << value.read() << '\n'; });
}#include<iostream>
#include<tiger/type_set.hpp>
#include<type_traits>intmain() {
tgr::tset<int, double, char*> set;
// Check for type existence -- O(1)
std::cout << tgr::tset_contains<int>(set) << '\n';
// Iterate over all types -- O(n)tgr::for_each(set, [](auto node) {
using T = typenamedecltype(node)::type;
if (std::is_arithmetic_v<T>) {
std::cout << "Arithmetic type found\n";
}
});
}#include<algorithm>
#include<iostream>
#include<tiger/short_string.hpp>intmain() {
tgr::short_string s = "Hello World";
// Interoperability with STL APIsstd::sort(s.begin(), s.end());
std::cout << s << '\n';
std::cout << s.size() << '\n';
}#include<cmath>
#include<sys/qos.h>
#include<tiger/service_thread.hpp>intkernel(int n) {
returnstd::atan(std::tan(n));
}
intmain() {
// Launch thread which may be pinned to P core
tgr::performance_thread p(kernel, 10);
p.join();
// Launch thread which may be scheduled on E core
tgr::efficiency_thread e(kernel, 10);
e.join();
// Launch thread with custom QoS class
tgr::service_thread<QOS_CLASS_UTILITY> u(kernel, 10);
u.join();
}#include<iostream>
#include<vector>
#include<tiger/stack_allocator.hpp>intmain() {
// Interoperability with STL containers
std::vector<int, tgr::stack_allocator<int, 1024>> v;
// Use existing container APIs without modification
v.push_back(-1);
std::cout << v.at(0) << '\n';
std::cout << v.size() << '\n';
}