Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4650

C/C++ • Using expected class

$
0
0
I have a Raspberry Pi Zero 2 W. I would like to use the expected class. When I try to compile the example located at https://en.cppreference.com/w/cpp/utility/expected

I get the following error:

Code:

$ g++ test.cpptest.cpp:13:50: error: ‘expected’ in namespace ‘std’ does not name a template type; did you mean ‘unexpected’?   13 | auto parse_number(std::string_view& str) -> std::expected<double, parse_error>      |                                                  ^~~~~~~~      |                                                  unexpectedtest.cpp:13:58: error: expected initializer before ‘<’ token
The version of g++ is

Code:

$ g++ --versiong++ (Debian 12.2.0-14) 12.2.0Copyright (C) 2022 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I assume that g++ version 12.2.0 -14 does not support C++23, How do I verify if a compiler supports C++23 ?

Thanks

Statistics: Posted by chriskot870 — Wed Oct 09, 2024 9:00 pm — Replies 2 — Views 42



Viewing all articles
Browse latest Browse all 4650

Trending Articles