An exception that is thrown because the value of a variable is outside the allowed range
Questions tagged [outofrangeexception]
272 questions
                    
                    21
                    
            votes
                
                2 answers
            
        Catching out_of_range on a vector of vectors
I have a vector of vectors to establish a map of integers, and I would love to catch a vector out of range error whenever it is thrown, by doing the following:
vector< vector > agrid(sizeX, vector(sizeY));
try {
    agrid[-1][-1] = 5;    …  
         
    
    
        David Chan
        
- 383
- 1
- 2
- 9
                    19
                    
            votes
                
                1 answer
            
        Exception 'out_of_range' not member of std?
I'm trying to write a simple linked-list and am trying to throw an out_of_range exception when the user wants a node index that is out-of-bounds. However, when I compile the source file, I get an error "'out_of_range' is not a member of 'std'".
It…
         
    
    
        Qwurticus
        
- 877
- 1
- 10
- 18
                    13
                    
            votes
                
                2 answers
            
        Differences between out_of_range, range_error, and over/underflow_error?
Could someone explain what the differences between range_error, out_of_range, and the pair of overflow_error and underflow_error are, when I should use each? They seem all like the same thing.
According to cppreference.com:
out_of_range:  It…
         
    
    
        Thanatos
        
- 42,585
- 14
- 91
- 146
                    13
                    
            votes
                
                2 answers
            
        C++ vector::_M_range_check Error?
Here's my function:
void loadfromfile(string fn, vector& file){
    int x = 0;
    ifstream text(fn.c_str());
    while(text.good()){
        getline(text, file.at(x));
        x++;
    }
    //cout << fn << endl;
}    
The value of fn that… 
         
    
    
        Mark S.
        
- 301
- 1
- 4
- 10
                    10
                    
            votes
                
                1 answer
            
        stoi causes out of range error
I have this code which gives me the error terminating with uncaught exception of type std::out_of_range: stoi: out of range
which I have identified as being caused by the line long ascii = std::stoi(temp_string);
what about the way i'm using stoi is…
         
    
    
        Rafa
        
- 3,219
- 4
- 38
- 70
                    8
                    
            votes
                
                8 answers
            
        Tell if string to double/float/int/short/byte is out of range
I have the following:
string outOfRange = "2147483648"; // +1 over int.MaxValue
Obviously if you have anything other than a number this will fail:
var defaultValue = 0;
int.TryParse(outOfRange, out defaultValue);
My question is, since this IS a…
         
    
    
        gleng
        
- 6,185
- 4
- 21
- 35
                    7
                    
            votes
                
                3 answers
            
        BIGINT Out-of-range Error since MySQL 5.5
I'm working with nested sets for my CMS but since MySQL 5.5 I can't move a node.
The following error gets thrown:
Error while reordering docs:Error in MySQL-DB: Invalid SQL:  
 SELECT baum2.id AS id,
 COUNT(*) AS level
 FROM elisabeth_tree AS…
         
    
    
        user718790
        
- 73
- 1
- 3
                    6
                    
            votes
                
                2 answers
            
        How do you do bounds checking with std span?
std::vector and pretty much all other containers have a very convenient way of bounds checking: at(). std::span doesn't have that apparently.
Why?
Is there a replacement? Other than rolling out your own at()?
         
    
    
        Aykhan Hagverdili
        
- 28,141
- 6
- 41
- 93
                    6
                    
            votes
                
                4 answers
            
        Fastmember exception: Specified argument was out of the range of valid values. Parameter name: name
I've been encountering this error 
Specified argument was out of the range of valid values. Parameter name: name
When im almost just copying the example here https://code.google.com/p/fast-member/
The error happens on the bcp.WriteToServer(reader),…
         
    
    
        user1465073
        
- 315
- 8
- 22
                    6
                    
            votes
                
                3 answers
            
        Program executed on Cygwin does not report a thrown exception
When I run a simple program shown below, I get different terminal output on Cygwin and Ubuntu OS.
#include    
#include    
#include    
using namespace std;
double square_root(double x)
{
    if (x < 0)
        throw…   
         
    
    
        user3623874
        
- 520
- 1
- 6
- 25
                    6
                    
            votes
                
                3 answers
            
        Error in magento when I try to delete a product
When I try to delete a product in Magento I get the next error and I don't know where is the problem.
SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range
         
    
    
        Lorena
        
- 193
- 7
- 18
                    5
                    
            votes
                
                1 answer
            
        C# ArgumentOutOfRangeException while reading ExcelWorksheet
I'm reading an OfficeOpenXml.ExcelWorksheet and getting the ArgumentOufOfRangeException on the middle of the Collection. 
I'm reading like this process.Information = sheet.Cells[line, i++].Text;. On this line i = 22 while the sheet.Dimension.Column…
         
    
    
        NunoRibeiro
        
- 511
- 2
- 7
- 22
                    5
                    
            votes
                
                2 answers
            
        How to check for std::vector out of range access
[Found a doublicate here: C++ - detect out-of-range access ]
If I have a programm with "out of range vector access", like this:
  std::vector A(2);
  ...
  A[10] = 3;
Do I have a way to find this error for sure?
I mean something like compile… 
         
    
    
        klm123
        
- 12,105
- 14
- 57
- 95
                    4
                    
            votes
                
                2 answers
            
        Delphi - How do I break when a form's ComponentCount decrements
The code below is reproduced from Toolbar2000.  It is part of routine that reads toolbar positions and dock states from an INI file.  I call this routine during initialisation.  This code below is iterating through all the components on the main…
         
    
    
        rossmcm
        
- 5,493
- 10
- 55
- 118
                    4
                    
            votes
                
                2 answers
            
        Prevent NSRangeException in subarrayWithRange
I have this code which allows me to pass in an index, and selectively retrieve, a number of  images in an array for a certain range length - depending on orientation.
When in portrait the range should be be 20 items per index, and i have 43 items…
         
    
    
        joec
        
- 3,533
- 10
- 60
- 89