by Anonymous » 22 May 2025, 22:40
Ich wollte dies ursprünglich tun, um ein Konzept zu erstellen, das nach Allokatoren prüft. Ich wollte sicherstellen, dass das Argument des Vorlagenarguments
übergeben wird, die folgende Aussage ist korrekt: < /p>
Code: Select all
std::allocator_traits::construct(alloc, ptr, ... /* parameters of constructors for AllocType::value_type */)
< /code>
Aber hier ist ein MRE: < /p>
#include
#include
#include
template
struct Allocator {
template
void construct(Args&&... args) {
T t { std::forward(args)... };
t.print();
}
};
struct X1 {
int i;
X1(int i) : i(i) { }
void print() { std::cout
Ich wollte dies ursprünglich tun, um ein Konzept zu erstellen, das nach Allokatoren prüft. Ich wollte sicherstellen, dass das Argument des Vorlagenarguments [url=viewtopic.php?t=23808]übergeben[/url] wird, die folgende Aussage ist korrekt: < /p>
[code]std::allocator_traits::construct(alloc, ptr, ... /* parameters of constructors for AllocType::value_type */)
< /code>
Aber hier ist ein MRE: < /p>
#include
#include
#include
template
struct Allocator {
template
void construct(Args&&... args) {
T t { std::forward(args)... };
t.print();
}
};
struct X1 {
int i;
X1(int i) : i(i) { }
void print() { std::cout