greg7mdp / gtl Goto Github PK
View Code? Open in Web Editor NEWGreg's Template Library of useful classes.
License: Apache License 2.0
Greg's Template Library of useful classes.
License: Apache License 2.0
support bazel
Release - 1.1.3, but:
gtl/include/gtl/gtl_config.hpp
Lines 37 to 39 in ba9386e
Commit: f80aefd
I think the std::erase_if
overload might be undefined behavior.
Maybe it's better to use ADL (https://en.cppreference.com/w/cpp/language/adl) and declare erase_if
in the gtl
namespace?
Please check it.
Links:
https://en.cppreference.com/w/cpp/language/extending_std
https://stackoverflow.com/a/11599/590688
reinterpret_cast
from float*
to uint*_t*
is UB (break strict aliasing).
Suggestions:
Lines 268 to 271 in 76382cc
uint32_t as_int;
std::memcpy(&as_int, &val, sizeof(as_int));
return (val == 0) ? static_cast<size_t>(0) :
static_cast<size_t>(as_int);
and
Lines 280 to 283 in 76382cc
uint64_t as_int;
std::memcpy(&as_int, &val, sizeof(as_int));
return (val == 0) ? static_cast<size_t>(0) :
fold_if_needed<sizeof(size_t)>()(as_int);
I am trying to remove duplicate and unused code in gtl.
Current state: https://github.com/phprus/gtl/tree/todo-1
I don't understand the need for declarations:
gtl/include/gtl/phmap_fwd_decl.hpp
Lines 36 to 39 in 06e07a3
and
gtl/include/gtl/phmap_fwd_decl.hpp
Lines 59 to 65 in 06e07a3
and
Lines 889 to 909 in 06e07a3
Maybe replace these definitions with using std::allocator, std::pair, std::equal_to, std::less directly?
Hi,
What's the use case for this library? Please add benchmarks against original implementation so that we can understand if this is faster.
Greg,
Do you have plans to add a multimap variant for your flat hash map?
One feature that would greatly decrease peak memory usage in my use-case is to have the ability to "steal" the backing array from the flat-maps (after compacting them into a "normal" array first of course.)
The use-case is currently implemented as follows:
Perhaps something along the lines of:
// Removes and returns an array of all entries in the set. Optimized implementations may re-use an internal array, thus
// lowering memory usage. Only the first size() entries are defined. It is the callers responsibility to delete the returned array.
value_type* remove_all_entries()
Oh, and thank you for the inspired lazy_emplace()! It's still more powerful than other map/set implementations of try_emplace since key creation can be deferred or customized as well.
The header file phmap.hpp
contains empty functions:
Lines 662 to 707 in 8471500
Some of these functions are not used anywhere.
Please tell me, are these functions needed or can they be removed?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.