You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template <class Element, any_view_options Opts, class Ref, class RValueRef,
248
234
class Diff>
@@ -459,6 +445,26 @@ user has to follow the same order of the options that are defined in `any_view_o
459
445
460
446
An implementation of this approach would look like this: [link](https://godbolt.org/z/4dGYneWxx)
461
447
448
+
## SG9 Decision
449
+
450
+
In Hagenberg, SG9 voted these designs
451
+
452
+
> I like the following template parameter design:
453
+
>
454
+
> - Proposed in P3411R1 (flags + defaulted template parameters)
455
+
> - Alternative 1 (variadic named template parameters)
456
+
> - Alternative 2 (custom traits with potentially some standard library provided default traits (e.g. the tags))
457
+
> - Alternative 3 (options aggregate type using type as values/reflection and designated initializers)
458
+
459
+
| Option | Approval votes |
460
+
|---------------|----------------|
461
+
| Proposed | 10 |
462
+
| Alternative 1 | 5 |
463
+
| Alternative 2 | 5 |
464
+
| Alternative 3 | 4 |
465
+
466
+
SG9 Recommended moving forward with the proposed design.
467
+
462
468
# Other Design Considerations
463
469
464
470
## Why don't follow range-v3's design where first template parameter is `range_reference_t`?
@@ -494,13 +500,23 @@ more general purpose utility in ranges library. Therefore, the authors recommend
494
500
## `constexpr` Support
495
501
496
502
We require `constexpr` because there is no strong reason not to provide it. Even when providing SBO at runtime, there is no need to provide such an optimization at compile-time as well, given that the conditions for the optimization are implementation-dependent, and experience shows this support is easy enough to add.
497
-
Both of our two reference implementations have proper `constexpr` support.
503
+
Both of our two reference implementations have proper `constexpr` support. SG9 also recommended in Hagenberg to support `constexpr`
498
504
499
505
## Move-only `view` Support
500
506
501
507
Move-only `view` is worth supporting as we generally support them in `ranges`. We propose to have a configuration template parameter `any_view_options::copyable` to make the `any_view` conditionally copyable. This removes the need to have another type as we did for `move_only_function`.
502
-
503
508
We also propose that by default, `any_view` is move-only and to make it copyable, the user needs to explicitly provide this template parameter `any_view_options::copyable`.
509
+
On R1 version, this paper proposed to make `any_view` copyable by default.
510
+
511
+
In Hagenberg, SG9 recommended to make it move-only by default with the votes:
512
+
513
+
> As proposed, any_view<T> is copyable by default, requiring a flag to allow type-erasing move-only types.
514
+
We want to change it to be move-only by default, requiring a flag to make it copyable and prohibit type-erasure of move-only types.
515
+
516
+
|SF |F |N |A |SA|
517
+
|---|---|---|---|--|
518
+
|4 |5 |1 |0 |1 |
519
+
504
520
505
521
## Move-only `iterator` Support
506
522
@@ -522,7 +538,15 @@ For simplicity, the authors propose to make `any_view` unconditionally non-const
522
538
## `common_range` support
523
539
524
540
Unconditionally making `any_view` a `common_range` is not an option. This would exclude most of the Standard Library `view`s. Adding a configuration template parameter to make `any_view` conditionally `common_range` is overkill. After all, if users need `common_range`, they can use `my_any_view | views::common`. Furthermore, supporting this turns out to add substantial complexity in the implementation.
525
-
The authors believe that adding `common_range` support is not worth the added complexity.
541
+
The authors believe that adding `common_range` support is not worth the added complexity. This is also confirmed with the votes in SG9 in Hagenberg.
542
+
543
+
> As proposed, any_view<T> is never a common range.
544
+
We want to have a flag to make it a common range if that flag is set.
545
+
546
+
|SF |F |N |A |SA|
547
+
|---|---|---|---|--|
548
+
|0 |1 |4 |2 |0 |
549
+
526
550
527
551
## `borrowed_range` support
528
552
@@ -537,7 +561,7 @@ Therefore, we recommend conditional support for `borrowed_range`. However, since
537
561
538
562
We propose providing the strong exception safety guarantee in the following operations: swap, copy-assignment, move-assignment and move-construction. This means that if the operation fails, the two `any_view` objects will be in their original states.
539
563
If the underlying view's move constructor (or move-assignment operator) is not `noexcept`, the only way to achieve the strong exception safety guarantee is to avoid calling these operations altogether, which requires `any_view` to hold its underlying object on the heap so it can implement these operations by swapping pointers.
540
-
This means that any implementation of `any_view` will have an empty state, and a "moved-from" `any_view` will be in that state.
564
+
This means that any implementation of `any_view` will have an empty state, and a "moved-from" heap allocated `any_view` will be in that state. Therefore, the authors propose to add default constructor to `any_view`, which results in an `any_view` object in such state. What's more, we need `operatorbool` to test if an `any_view` object is in this state.
541
565
542
566
## ABI Stability
543
567
@@ -808,7 +832,7 @@ We can see the `any_view` version is 4 times faster. This is a very common patte
808
832
809
833
`any_view` has been implemented in [@rangev3], with equivalent semantics as
810
834
proposed here. The authors also implemented a version that directly follows the
811
-
proposed wording below without any issue [@ours] and [bemanproject].
835
+
proposed wording below without any issue [@ours] and [@bemanproject].
0 commit comments