Comments (2)
This is more tricky than I thought, because the NeverValueField requires that the field type be trivially constructible. This is required in order for Option to be constexpr at all.
The field in Array is T data_[N];
which is not trivially constructible, and is not a pointer as I wrote above silly me.
What I could do is defer it to the first element of the array if T is NeverValueField. That would require adding some more complexity to the never_value_field APIs to expose the field that is never-value, in order to reuse it from Array.
from subspace.
I'm not sure it's worth having X<T>
be NeverValueField and X<U>
not be, changing the layout of Option like that would be hard to understand from a user perspective. So making the NeverValueField conditional is probably not what I want to do, so Array can't be NeverValueField.
from subspace.
Related Issues (20)
- Cow type (Clone-on-write)
- Use seto to look for overflow
- Optimize storage for Result with NeverValueField HOT 1
- Compile-time option for overflow checks
- Add `c_int` and `c_uint` portability helper type
- TryFrom<ToType, FromType> should be satisfied for all From<ToType, FromType>
- Rewrite Tuple's impl to not be recursive HOT 1
- Provide Tuple::as_ref and as_mut
- DynIterator type erasure
- Think about Vec construction from variadics
- Iterator::collect should ideally support conversions HOT 1
- Nested classes missing in Subdoc
- Generate nested classes/enums. Where to display them?
- Friend decls are showing up in the overload set
- Subdoc fails with missing modmap files HOT 8
- Implement Error for string/string_view HOT 1
- compat_ headers are an ODR nightmare HOT 1
- Option::as_slice and as_mut_slice HOT 2
- Mark Slice and SliceMut as O(1) to construct via std::ranges::enable_view
- Add clang 19 bots and fix clang 18 bots 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 subspace.