Код: Выделить всё
#include
// Forward declaration of construct, using return type deduction
template
auto construct(Args... args);
// Specialization for Version 1 – takes const reference
template
auto construct(const std::optional& o) {
return 0;
}
// Specialization for Version 2 – takes by value
template
auto construct(std::optional o) {
return 0;
}
int main() {
std::optional o;
construct(o); // fails
construct(o); // works
return 0;
}
Код: Выделить всё
error: function 'construct' with deduced return type cannot be used before it is defined
Мои вопросы:
- phostra> phode> phod> phod>, но и Code, но
Подробнее здесь: https://stackoverflow.com/questions/797 ... fined-when