(C++) std::invalid\_argument

January 11, 2018 · View on GitHub

 

 

 

 

 

(C++) std::invalid_argument

 

An exception that is thrown due to invalid arguments.

 

In the exception hierarchy, std::invalid_argument is a derived class from std::logic_error.

 

 

 

 

 

Example

 

std::invalid_argument is thrown when the constructor of std::bitset is given a std::string that does not consist of zeroes and ones:

 


#include <bitset> int main() {   std::bitset<8> byte(std::string("01234567")); }

 

 

 

 

 

 

  1. GCC reference on std::invalid_argument