Comments (2)
I'm not familiar with Eigen.
to()
was standardized from C++23, you can find the mechanism for how it works here. In short, if C
is the destination type and r
is the source range, it'll try to do (in order):
C(r)
C(from_range, r)
C(ranges::begin(r), ranges::end(r))
C c; /* try to reserve */; ranges::copy(r, /* inserter into c */);
- A more complicated thing for recursion
It looks like option (4) there might work for Eigen::VectorXd, does it? If so we could try to extend the implementation here to do something similar.
range-v3 right now tries to do
C c; r.reserve(ranges::size(r)); c.assign(ranges::begin(r), ranges::end(r));
C(ranges::begin(r), ranges::end(r))
from range-v3.
Thanks for all the info!
Indeed option 4 should work with Eigen. Its pretty much what I do in my custom function in the original comment as you noted.
I tried with c++23 std::ranges::to (should've done before) but unfortunately it doesn't compile.
https://godbolt.org/z/rsd8bdEKc
So I am not sure that in the end it would work with ranges-v3 either. Maybe Eigen would need to do something as well.
from range-v3.
Related Issues (20)
- "ranges::to" failed for template type T with universal construction HOT 2
- warning: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Wdeprecated]
- cannot create any_view from empty_view
- view chunk can't compile? HOT 1
- Cast issue with GCC12 HOT 2
- Remove duplicate elements from multiple input vectors at the same time
- views::generate doesn't work with views::chunk_by HOT 5
- C++23's range_adaptor_closure equivalent HOT 2
- Security disclosure policy
- Range-v3 fails to compile on the latest MSVC version with Visual Studio 2022 HOT 1
- CMAKE_CXX_STANDARD 20 and RANGES_CXX_STD 17 - does not work HOT 1
- pipe adaptor support for tuple_algorithm.hpp
- Nested `key_type` for lazy set algorithms formatting?
- UB in std::views::split HOT 7
- action::remove not included
- Error when using function return value directly HOT 1
- MSVC warning C4702: unreachable code with NDEBUG
- JVM / Python / OOP like group_by view
- operator = for ranges::views::concat result HOT 1
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 range-v3.