Hi, @Flaviu_
From the doc: https://learn.microsoft.com/en-us/cpp/standard-library/string-view?view=msvc-170
Requirements
Header: <string_view>
Namespace: std
- Compiler Option:
std:c++17
or later.
You can also use header files that include xstring
, such as iostream
, string
.
string_view
header
#ifndef _STRING_VIEW_
#define _STRING_VIEW_
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#if !_HAS_CXX17
_EMIT_STL_WARNING(STL4038, "The contents of <string_view> are available only with C++17 or later.");
#else // ^^^ !_HAS_CXX17 / _HAS_CXX17 vvv
#include <xstring>
#endif // ^^^ _HAS_CXX17 ^^^
#endif // _STL_COMPILER_PREPROCESSOR
#endif // _STRING_VIEW_
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.