slavenf / sfl-library Goto Github PK
View Code? Open in Web Editor NEWC++11 header-only library. Small and static vector. Small and static flat map/set. Compact vector. Segmented vector.
License: zlib License
C++11 header-only library. Small and static vector. Small and static flat map/set. Compact vector. Segmented vector.
License: zlib License
Hello, we are building sfl-library and we found the follow line in the Cmake code:
https://github.com/slavenf/sfl-library/blob/master/CMakeLists.txt#L19
Which results in the follow installation:
% cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/tmp/install2
% cmake --build build --target install
Install the project...
-- Install configuration: ""
-- Installing: /tmp/install2/include/sfl
-- Installing: /tmp/install2/include/sfl/small_flat_map.hpp
-- Installing: /tmp/install2/include/sfl/small_unordered_flat_multiset.hpp
-- Installing: /tmp/install2/include/sfl/small_flat_multimap.hpp
-- Installing: /tmp/install2/include/sfl/small_unordered_flat_map.hpp
-- Installing: /tmp/install2/include/sfl/small_vector.hpp
-- Installing: /tmp/install2/include/sfl/compact_vector.hpp
-- Installing: /tmp/install2/include/sfl/small_flat_set.hpp
-- Installing: /tmp/install2/include/sfl/segmented_vector.hpp
-- Installing: /tmp/install2/include/sfl/small_unordered_flat_multimap.hpp
-- Installing: /tmp/install2/include/sfl/small_flat_multiset.hpp
-- Installing: /tmp/install2/include/sfl/small_unordered_flat_set.hpp
So, I'm not sure if that's the expected installation tree, because the CMake file is using include
as destination. So, adding the follow patch (adding an extra slash):
install(
DIRECTORY
include/sfl/
DESTINATION
include
)
Will result as:
% cmake --build build --target install
Install the project...
-- Install configuration: ""
-- Up-to-date: /tmp/install2/include
-- Up-to-date: /tmp/install2/include/small_flat_map.hpp
-- Up-to-date: /tmp/install2/include/small_unordered_flat_multiset.hpp
-- Up-to-date: /tmp/install2/include/small_flat_multimap.hpp
-- Up-to-date: /tmp/install2/include/small_unordered_flat_map.hpp
-- Up-to-date: /tmp/install2/include/small_vector.hpp
-- Up-to-date: /tmp/install2/include/compact_vector.hpp
-- Up-to-date: /tmp/install2/include/small_flat_set.hpp
-- Up-to-date: /tmp/install2/include/segmented_vector.hpp
-- Up-to-date: /tmp/install2/include/small_unordered_flat_multimap.hpp
-- Up-to-date: /tmp/install2/include/small_flat_multiset.hpp
-- Up-to-date: /tmp/install2/include/small_unordered_flat_set.hpp
No sfl
subfolder listed.
I still prefer the current behavior with sfl
folder, because it keeps a namespace to avoid header name collision.
Regards.
cout << "Test constructor(small_vector&&) (N == 0)." << endl;
{
sfl::small_vector<xint, 0, TPARAM_ALLOCATOR<xint>> v1({10, 20, 30, 40, 50});
sfl::small_vector<xint, 0, TPARAM_ALLOCATOR<xint>> v2(std::move(v1));
// v1 is in a valid but unspecified state
CHECK(v1.size() == 0); //*************** new add. failed this **********************
CHECK(v2.size() == 5);
CHECK(v2.capacity() == 5);
CHECK(*v2.nth(0) == 10);
CHECK(*v2.nth(1) == 20);
CHECK(*v2.nth(2) == 30);
CHECK(*v2.nth(3) == 40);
CHECK(*v2.nth(4) == 50);
sfl::small_vector<xint, 0, TPARAM_ALLOCATOR<xint>> v3(std::move(v2), TPARAM_ALLOCATOR<xint>());
// v2 is in a valid but unspecified state
CHECK(v3.size() == 5);
CHECK(v3.capacity() == 5);
CHECK(*v3.nth(0) == 10);
CHECK(*v3.nth(1) == 20);
CHECK(*v3.nth(2) == 30);
CHECK(*v3.nth(3) == 40);
CHECK(*v3.nth(4) == 50);
}
Are there any plans to add this specialized function to match the deque interface? One of the reasons to why deque is pretty good is that push_front is reasonably fast. I'm not exactly sure how its implemented for deque but if I had to guess they just allocate a new block when the one at the beginning is full and only move the last element into the new block rather than shifting all elements across all the blocks.
Hello,
Nice idea, I am surprised there is still no hybrid stack/heap standardized containers like small_vector, fmt::basic_memory_buffer...
I was wondering if reserve/resize should deallocate heap when shrinking. I would expect that only shrink_to_fit would do so.
When being used in a loop, for example, it could cost some useless allocations ?
Thank you
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.