Collection of C++ snippets and header files that could be useful. Build and test with:
cmake .
make test
./test
invsqrt.h
. Quake fast inverse square root for floats/doubles.stl_eigen_facade.h
. Access vector of structures as Eigen objectspairwise_iterator.h
. Generates an iterable object pointing to all unique pairs in one container or between two containers. Dereferencing returns astd::tuple
holding (const) references to the underlying data.(similar to Python'sstd::vector<std::string> v = {"one","two", "three"}; for (auto [i,j] : internal_pairs(v)): std::cout << i << "-" << j << " "; // --> "one-two" "one-three" "two-three"
itertools.combinations
)(similar to range-v3'sstd::vector<std::string> v1 = {"one","two"}, v2 = {"three"}; for (auto [i,j] : cartesian_product(v1,v2)): std::cout << i << "-" << j << " "; // --> "one-three" "two-three"
cartesian_product
)