Talk:cpp/string/basic string/stol

I would like to understand how the stoi function work and if there is a specific library stuff I need \to add to get the function to run. When I try the code bellow, my compilor said stoi is not a member of std. What am I doing wrong?


 * The program compiles and runs. Based on the error, it's likely that your compiler is either too old to support C++11 or is not configured to do so. --Cubbi (talk) 14:12, 24 November 2014 (PST)

What is pos set to if the whole string is numeric?
The current description doesn't specify what happens to pos if the whole string is numeric. It simply says pos is set to the index of the first unconverted character. If there are no unconverted characters, then this sentence is meaningless. We know that the implementation of the string class makes the data end with a null character, which would indeed be the "first unconverted character", but the null is conceptually not part of the string itself, so it is invalid to say that it has an index within the string.
 * the description is not referring to the implementation of the string class, it is referring to the string obtained from str.c_str. Let's see if it can be made clearer. --Cubbi (talk) 06:42, 8 October 2015 (PDT)

Is there a reason for not using nullptr for pointers (instead of 0)?
Since C++11, we have the `nullptr` literal for null pointers. I see here that 0 is still being used. Is that because it's like that in the reference? --Alexis Wilke (talk) 14:48, 10 June 2018 (PDT)

string_view and future standards
Why is there no overload for string_view? Did it simply not make it in time, or has it deliberately been decided not to provide such an overload? - Søren Nissen
 * that's proposal p0506. It was rejected in albuquerque 2017 meeting (after mulling renaming the new overloads svtoi/svtol/etc) --Cubbi (talk) 20:06, 15 December 2020 (PST)