As from the reference documentation, std::stoi()
must be expected to throw these exceptions:
Exceptions
std::invalid_argument
if no conversion could be performed std::out_of_range
if the converted value would fall out of the range of the result type or if the underlying function (std::strtol
or std::strtoll
) sets errno
to ERANGE
.
Thus this exception depends on your actual input, which you’re currently not disclosing from your question (unfortunately).
Related Posts:
- How to implement 2D vector array?
- What is the difference between g++ and gcc?
- What is the best way to use a HashMap in C++?
- What is the difference between float and double?
- How do I find the length of an array?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- g++ ld: symbol(s) not found for architecture x86_64
- Making my own toString() method on c++ struct
- Struct Constructor in C++?
- What is meant with “const” at end of function declaration? [duplicate]
- How to create timer events using C++ 11?
- How to concatenate two strings in C++?
- ‘g++’ is not recognized as an internal or external command, operable program or batch file
- Read file line by line using ifstream in C++
- Virtual/pure virtual explained
- error: redefinition of class
- Officially, what is typename for?
- How do I iterate over the words of a string?
- C++ Vector of pointers
- error: lvalue required as unary & operand
- What is use of c_str function In c++
- Is there a decent wait function in C++?
- What does T&& (double ampersand) mean in C++11?
- C++ – No matching member function for call to ‘push_back’
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- How to find memory leak in a C++ code/project?
- invalid use of non-static member function
- Cannot open include file: ‘stdio.h’ – Visual Studio Community 2017 – C++ Error
- srand(time(0)) and random number generation
- How to convert integer to double implicitly?
- How do I tokenize a string in C++?
- Reverse Contents in Array
- Why would we call cin.clear() and cin.ignore() after reading input?
- Should I learn C before learning C++?
- Comparison with string literal results in unspecified behaviour?
- c++: No instance of overloaded function
- C++ error: Undefined symbols for architecture x86_64
- Visual Studio debugger error: Unable to start program Specified file cannot be found
- Printing the correct number of decimal points with cout
- Destructor for a linked List
- Why use a new call with a C++ ‘vector’?
- Identifier is undefined
- What are the most widely used C++ vector/matrix math/linear algebra libraries, and their cost and benefit tradeoffs?
- Insert object at index of vector c++
- Read whole ASCII file into C++ std::string
- Reading getline from cin into a stringstream (C++)
- How to make an array with a dynamic size? General usage of dynamic arrays (maybe pointers too)?
- C++ int float casting
- How to check that an element is in a std::set?
- Best way to extract a subvector from a vector?
- How do malloc() and free() work?
- Call to implicitly deleted copy constructor in LLVM
- C++ Linked List Node with class
- What is the use of intptr_t?
- QltAW.png
- std::wstring VS std::string
- error: expected unqualified-id before ‘.’ token //(struct)
- Base class undefined
- C++ – Assigning null to a std::string
- The program can’t start because libgcc_s_dw2-1.dll is missing
- C++ – Too Many Initializers for Arrays
- Reading string by char till end of line C/C++
- getline: identifier not found
- Colorizing text in the console with C++
- Show two digits after decimal point in c++
- error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
- gcc: undefined reference to
- “Field has incomplete type” error
- C++ Returning reference to local variable
- How do I flush the cin buffer?
- C++ Return value, reference, const reference
- CMake : C and CXX compiler identification is unknown Win10 CMakeGUI
- Error “Unterminated conditional directive” in cross-referencing headers
- C++ template – error: expected initializer before ‘<' token
- Why am I getting the “Expression is not assignable” error?
- template argument deduction/substitution failed, when using std::function and std::bind
- Converting string to ASCII
- got “cannot appear in a constant-expression” when using template
- C++ ostream and ofstream conversions
- C++ discards qualifiers
- What is the source of the data for the ProgramFiles, ProgramW6432Dir, ProgramFilesDir (x86), CommonProgramFiles environment variables?
- C++ : Exception occurred in script: basic_string::_S_construct NULL not valid
- function does not take 1 arguments c++
- overloaded function with no contextual type information
- How exactly do lookup tables work and how to implement them?
- Vector declaration “expected parameter declarator”
- C++ Destructors with Vectors, Pointers,
- error C2065: ‘cout’ : undeclared identifier
- How to get the MD5 hash of a file in C++?
- C++ Error: Expected a type specifier
- Where to declare/define class scope constants in C++?
- Friend methods error
- Does WPF Work with C++?
- Multiple inputs on one line
- “Incomplete type not allowed ” when creating std::ofstream objects
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- ‘&’ : illegal operation on bound member function expression [duplicate]
- Multiple definitions of “Main”
- Getting the error floating point exception: 8