chobolabs / chobo-shl Goto Github PK
View Code? Open in Web Editor NEWA collection of single-header C++11 libraries by Chobolabs
License: Other
A collection of single-header C++11 libraries by Chobolabs
License: Other
Hi, I've been using flat_map as a replacement for std::map, and I've been liking the ease of integration (literally just renaming my structures and it works!). My question is, will there be a flat_hash in the future that replaces unordered_map?
small_vector
's emplace_back
return void.
To be drop-in replacement to std::vector
it must return reference to emplaced element.
need this ?
some_type &some_type::operator=(some_type const &other)
{
if(this != &other)
{
// do something
}
return *this;
}
It would make it more of a drop-in replacement
The following :
chobo::small_vector<std::size_t> vec(5, 0);
does not compile; it triggers the small_vector(InputIterator first, InputIterator last)
constructor (and then fails when trying to dereference in assign_impl
) .
I could solve it quickly by a small sfinae if this can be useful:
template <class InputIterator, typename = decltype(*(std::declval<InputIterator>()))>
if (i != end() && i->first == k)
should be
if (i != end() && !m_cmp(k, i->first))
and some other interface same problem ...
Not sure if this can be worked around by changing the code directly, but after some hours of revising NatVis I managed to find a definition that seems to work:
<Type Name="chobo::static_vector<*>">
<DisplayString>{{size = {m_size}}}</DisplayString>
<Expand>
<Item Name="Type">"$T1"</Item>
<ArrayItems>
<Size>m_size</Size>
<ValuePointer>($T1*)(this)</ValuePointer>
</ArrayItems>
</Expand>
</Type>
It might be useful for future Visual Studio users to include a natvis file for the different classes.
Anyway, thank you for the library!
static_vector use ::new
optional.hpp line 250
new (p) value_type(std::forward<Args>(args)...);
new
to ::new
?
When trying to compile small_vector with MSVC 15.9 I'm getting following error:
small_vector.hpp(189): error C4996: 'std::allocator<T>::size_type': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
There is only static_vector::erase(iterator)
. It lacks static_vector::erase(iterator, iterator)
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.