roy cabouly
roy cabouly

Reputation: 547

visual studio 2019 c++ - concept identifier is undefined

I have tried to use concepts in my cpp project which I write using visual studio 2019 version 16.4.1 but I get and error message: "identifier conecpt is undefined". As far as I know concepts have support in visual studio 2019 since version 16.3 so I cant understand why it still doesn't work for me.

Here is the code I have written, Is there any foolish syntax error in it?

#include<concepts>
template<typename T>
concept has_type_member = requires { typename T::type; }

If not has anyone have had such a problem and have managed to overcome it?

Upvotes: 4

Views: 6532

Answers (1)

Jeaninez - MSFT
Jeaninez - MSFT

Reputation: 4040

C++20 Concepts are now supported for the first time in Visual Studio 2019 version 16.3 Preview 2.

According to the blog:

First, we’re debuting the feature via /std:c++latest mode and once we have all C++20 features implemented across all Visual Studio products (compiler, library, IntelliSense, build system, debugger, etc.), we’ll provide them through a new /std:c++20 mode. IntelliSense support is not currently available and our implementation doesn’t yet include recent changes in the ISO C++ standards meeting in Cologne.

I suggest you should try to use /std:c++latest mode.

You can set this at Project > Properties > Configuration Properties > C/C++ > Language > C++ Language Standard > Preview - Features from the Latest C++ Working Draft (/std:c++latest)

Upvotes: 4

Related Questions