foonathan / array Goto Github PK
View Code? Open in Web Editor NEWcontiguous container library - arrays with customizable allocation, small buffer optimization and more
License: Boost Software License 1.0
contiguous container library - arrays with customizable allocation, small buffer optimization and more
License: Boost Software License 1.0
Hi,
I'm trying to invoke LLVM's argument parser programaticaly (i.e. not from main with main args) and I was wondering if the array library could help me there. The issue is that llvm::ParseCommandLineOptions
takes raw argc
and argv
arguments directly, where argv
is a char**
. I was trying to implement my argument parser so that it can be invoked from a sane C++ API (Say, using a vector of string views), and I was wondering if any of the array lib views could be converted directly or indirectly to a char**
.
Thanks in advance.
where order of elements isn't imported
==>
where order of elements isn't important* << perhaps?
Just an idea, but it kind of looks like Bip buffer implementation would fit on top of block storage concept here quite well.
Key word being 'contiguous memory container'. ( https://github.com/willemt/bipbuffer , https://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist )
I'll try take a stab at getting something working, any pointers for the interface design ?
In flat_set::assign, the container only provides the basic exception guarantee if memory cannot be stolen from the input and the ::reserve() allocation throws. In addition, since input_view does not specify that its value_type is nothrow move or copyable, the operation may again fail during the translation of elements from the view into the set.
array_.clear();
array_.reserve(input.size()); // <-- might throw here, leaving the container empty
// insert all elements individually
for (auto& element : input.view())
{
if (input.will_copy())
insert(element); // <-- could also throw here, leaving a partially filled container
else
{
// safe, according to precondition of input view,
// we're allowed to move them
auto& non_const = const_cast<Key&>(element);
insert(std::move(non_const)); // <-- or here
}
}
It looks like you are already aware of this, given the TODO comments in flat_map's assign* functions:
template <typename InputIt>
void assign_pair_range(InputIt begin, InputIt end)
{
// TODO: exception safety
clear();
insert_pair_range(begin, end);
}
A simple solution to add strong exception safety would be to create a new flat_set from the input range and swap if there was no exception thrown.
Something like https://ned14.github.io/outcome/use-matrix/, for fools like me who feel overwhelmed by the feature list.
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.