86 questions
7
votes
2
answers
237
views
C++26 constant_wrapper and constant_arg_t
C++26 introduces constant_wrapper which is a powerful wrapper of compile-time constant as a type system part.
C++26 also introduces function_ref, which has its own constant_arg_t wrapper (was called ...
17
votes
2
answers
870
views
Rationale of variadicity of std::function_ref
Whereas:
std::function has a single type, i.e template <typename Sig> std::function<Sig>;
std::function_ref is variadic, i.e template< class...> class function_ref; (and all ...
4
votes
1
answer
139
views
C++26 Reflection: Define an Aggregate Template
I know that you can use C++26 Reflection to define non-template aggregate types or even specific specializations of templates (demo).
My Question now is: Is it also possible to define the entire ...
4
votes
3
answers
187
views
`std::span` and static storage for braced initializers (P2752R3)
I am trying to compile the following code with GCC 15 (C++26 enabled):
constexpr std::span<const int> s = {0,0};
However, the following compiler error occurs:
span.cpp:7:48: error: ‘std::span&...
2
votes
2
answers
159
views
Do C++ value categories/copy elision rules change with C++26 replaceable_if_eligible?
How does the concept of trivial relocatability from C++26 change how we reason about value categories?
Do they interact at all (e.g., temporary-materialization rules)?
For instance, if I have a ...
Advice
1
vote
3
replies
87
views
Compile time index access using C++26 reflection
The question has moved to be a Q&A post following the comments:
C++ reflection - compile time index access - but not with a macro
3
votes
1
answer
141
views
Extracting member function traits with C++26 reflection
Background info: I am trying to write a source code (i.e., plain text) generation tool which generates a stub implementation of an abstract base class. This looks something like
namespace acme {
...
4
votes
1
answer
131
views
How to declare a variable using std::meta::info of a non static data member inside a template for loop?
So, this works:
#include <meta>
int main() {
int a = 1;
constexpr std::meta::info IntInfo = ^^int;
[:IntInfo:] b = 42;
}
https://godbolt.org/z/ffjnETWzb
I'd like to declare a ...
2
votes
2
answers
163
views
C++ reflection - compile time index access - but not with a macro
Using C++26 reflection, the following works nicely:
template<size_t from, size_t to, typename F>
void compile_time_index_access(size_t index, F&& f) {
template for(constexpr size_t i : ...
5
votes
3
answers
706
views
What impediments are there to inclusion of the Networking TS in the C++26 standard?
As C++26 standard's timeline is getting near, I want to know:
What is(are) the reason(s) for no built in support of networking in the C++ standard. That is, what exactly are the problems that lead to ...
Advice
0
votes
7
replies
134
views
Do C++ value categories rules such as copy elision change with C++26 trivially_relocatable_if_eligible?
C++11 value categories (lvalues, xvalues, and prvalues) are deeply entangled to the core of C++ itself in a way that's not possible to reason about C++ w/o reasoning about value semantics.
C++17 ...
1
vote
1
answer
164
views
How to add a string literal annotation to items?
I am experimenting with the new annotation freshly added in C++26, specifically looking at the examples provided in the proposal paper.
The paper contains the following example using a hypothetical ...
Advice
5
votes
3
replies
5k
views
Is C++26 getting destructive move semantics?
Can I express a function that consumes an object? Meaning that its destructor is not run on the moved-from object?
Like the proposed library function trivially_relocate_at itself?
template <class T&...
Advice
0
votes
1
replies
54
views
Pack expansion with function which requires ordering/index
i need to call a function bar from foo with pack expansion of template arguments
bar needs an index, its not stateful but i need the index of the template argument
#include <string>
#include <...
1
vote
0
answers
109
views
How do I configure VSCode IntelliSense to use my local GCC trunk build?
I have built GCC 16.0 trunk in order to test out the new C++26 reflection capabilities. I am developing using WSL (Ubuntu) and VSCode.
As it stands, I have the following basic example in a simple ...