Discussion Overview
The discussion revolves around the use of string_view in C++17 within Visual Studio (VS), specifically addressing issues related to code compilation and understanding of the string_view functionality. Participants explore troubleshooting techniques, code translation to C-strings, and the implications of compiler settings.
Discussion Character
- Technical explanation
- Debate/contested
- Homework-related
Main Points Raised
- One participant reports an issue with
string_view not being recognized in their VS-2019 environment, providing a code snippet for context.
- Another participant suggests that the issue may be related to missing the
std:: prefix when using string_view.
- Multiple participants emphasize the need to set the compiler option to
/std:c++17 to enable C++17 features.
- A participant shares a code example involving a class that utilizes
string_view and expresses a desire to translate it to use C-strings for better understanding.
- Another participant points out that the translation to C-strings results in only the first character being printed, prompting a request for help.
- Participants discuss the return type of a method in the translated code, with suggestions that it should return a string rather than a char.
- There are corrections regarding the understanding of pointers and return types, with some participants expressing frustration over the lack of clarity in the original poster's code.
Areas of Agreement / Disagreement
Participants generally agree that the issue with string_view may stem from compiler settings and the need for proper usage of prefixes. However, there is disagreement regarding the specifics of the return type in the translated C-string code, and the discussion remains unresolved on the best approach to fix the issues presented.
Contextual Notes
Some participants note that the original poster did not provide error messages, which could be crucial for debugging. Additionally, there are unresolved discussions about pointer usage and return types in the context of C-strings.