1 /*
2  * Copyright (c) 1999
3  * Silicon Graphics
4  *
5  * Permission to use, copy, modify, distribute and sell this software
6  * and its documentation for any purpose is hereby granted without fee,
7  * provided that the above copyright notice appear in all copies and
8  * that both that copyright notice and this permission notice appear
9  * in supporting documentation.  Silicon Graphics makes no
10  * representations about the suitability of this software for any
11  * purpose.  It is provided "as is" without express or implied warranty.
12  *
13  */
14 
15 #ifndef __STL_RANGE_ERRORS_H
16 #define __STL_RANGE_ERRORS_H
17 
18 // A few places in the STL throw range errors, using standard exception
19 // classes defined in <stdexcept>.  This header file provides functions
20 // to throw those exception objects.
21 
22 // __STL_DONT_THROW_RANGE_ERRORS is a hook so that users can disable
23 // this exception throwing.
24 
25 #include <stl_config.h>
26 
27 #if defined(__STL_CAN_THROW_RANGE_ERRORS) && \
28     defined(__STL_USE_EXCEPTIONS) && \
29     !defined(__STL_DONT_THROW_RANGE_ERRORS)
30 # define __STL_THROW_RANGE_ERRORS
31 #endif
32 
33 // For the SGI 7.3 compiler, declare these functions here and define them
34 // elsewhere.
35 #if defined(__STL_THROW_RANGE_ERRORS) && \
36     defined(__sgi) && !defined(__GNUC__) && \
37     _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
38 
39 __STL_BEGIN_NAMESPACE
40 void __stl_throw_range_error(const char* __msg);
41 void __stl_throw_length_error(const char* __msg);
42 __STL_END_NAMESPACE
43 
44 // For other compilers where we're throwing range errors, include the
45 // stdexcept header and throw the appropriate exceptions directly.
46 #elif defined(__STL_THROW_RANGE_ERRORS)
47 
48 #include <stdexcept>
49 
50 __STL_BEGIN_NAMESPACE
51 inline void __stl_throw_range_error(const char* __msg)
52   { throw range_error(__msg); }
53 inline void __stl_throw_length_error(const char* __msg)
54   { throw length_error(__msg); }
55 __STL_END_NAMESPACE
56 
57 // Otherwise, define inline functions that do nothing.
58 #else
59 
60 __STL_BEGIN_NAMESPACE
61 inline void __stl_throw_range_error(const char*) {}
62 inline void __stl_throw_length_error(const char*) {}
63 __STL_END_NAMESPACE
64 
65 #endif
66 
67 #endif /* __STL_RANGE_ERRORS_H */
68 
69 // Local Variables:
70 // mode:C++
71 // End:
72