Comments (6)
This would be a nice example
from url.
If we do this in the library it would be something like
subrange params_encoded_view::find_all( string_view key );
from url.
It would be nice to have an API that make possible to return all values associated with a key in a list/container
I don't think the library should provide this explicitly. Instead, with the proposed find_all
above, you could use std::back_insert_iterator
(C++11) or one of the new fancy range algorithms to fill in the container of your choosing, even supporting custom allocators.
from url.
boost.http.proto supports this:
https://github.com/CPPAlliance/http_proto/blob/dc92ac4e05ad8b1b4b60ec8924b2f0cfa1167598/include/boost/http_proto/fields_view.hpp#L243
from url.
Cons:
- It would be like emulating map::equal_range to a container where equal keys are not in order. We also have
unordered_map::equal_range
but the equal keys are also in sequence in these containers. - To emulate something that's not there, we would need a view that would be a lot like
ranges::views::filter
and pretend this is native. This would need a reasonable API, etc... which could involve a lot of work to get right. - There are many possible designs for the API, like a
std::back_insert_iterator
. Each design would serve only a subset of users. - Doing that implicitly might indicate to the user this happens in constant time, like some kind of weird
vector::push_front
would. - This is useful for avoiding a for-loop. But seems like a lot of work for just avoiding a for-loop. Users would need to understand the design.
Pros:
On the other hand, params::find
does the same thing, assuming linear time is justifiable for URLs. Since params::find_all
would also be linear time, it's not something completely without a precedent.
However, params::find
has a much simpler interface, since we just return one iterator that already exists, so the precedent is not completely there.
from url.
we can just wait until a user requests it.
from url.
Related Issues (20)
- Boost.URL as subproject should not automatically add dependencies
- Boost CMake testing procedure doesn't work for URL
- Reconfiguring with BUILD_TESTING=OFF doesn't disable tests
- `boost::urls::resolve` gives wrong result when there are more `..`s in relative reference HOT 6
- sanitize_uri moves host to path
- Slash in query param not being encoded as %2F HOT 5
- docs build tmp files HOT 4
- UB Sanitizer implicit-integer-sign-change warning in boost::urls::grammar::detail::find_if_not_pred HOT 6
- Missing coverage
- Source files should not include header guards
- coverage job is generating an empty file
- detail symbol in reference
- Missing codecov token in GHA
- Improve coverage
- When compiling the boost.url libs comes the errors HOT 3
- Exclude tests from Antora compile commands
- craypp crash compiling segments_view.cpp HOT 1
- Test libraries and executables should be declared EXCLUDE_FROM_ALL
- Fix security vulnerabilities detected in Antora docs HOT 1
- Fix urls::errc reference
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from url.