lenerror.htm
来自「这是关于VC++中的STL容器的资料,包括了STL容器各个类之间关系以及类的说明」· HTM 代码 · 共 111 行
HTM
111 行
<html>
<head>
<title> The length_error Class</title>
</head>
<body bgcolor="#FFFFFF">
<img src="leban3.gif">
<pre>
<font size=5>Class Name</font> length_error
<font size=5>Header File</font> <stdexcept>
<font size=5>Classification</font> Exception
</pre>
<a href="lenerror.htm#diagram">Class Relationship Diagram</a><br>
<br>
<a href="lenerror.htm#desc">Class Description</a><br>
<h1>Member Classes</h1>
<i>None</i>
<h1>Methods</h1>
<a href="lenerror.htm#lengtherror">length_error(const string &What_Arg)</a><br>
<a name="desc"><h3>Description</h3></a>
<p>
Description
The length_error class is derived from the logic_error class. The length_error
class represents exceptions that are occur because some piece of the software component
that causes the exception is attempting to produce an object whose length is larger than
the maximum allowable size. What a length_error exception means is class dependent and is
determined by context. This class represents a node class and can therefore be used as a
base class for user defined classes. Objects of type length_error are thrown by methods in
the standard C++ class library.
</p>
<hr>
<pre>
<a name="lengtherror">Method length_error()</a>
Access Public
Classification Constructor
Syntax length_error(const string &What_Arg)
Parameters The What_Arg parameter should contain a description of the kind of exception
that has occurred.
Return None
</pre>
<h3>Description</h3>
<p>
The length_error() method constructs an object of type length_error. The What_Arg parameter
can be used to set a description of the kind of error that this exception represents.
A set possible solutions is sometimes supplied with the exception description in addition
to the type of error.
</p>
<hr>
<a name="diagram"><h2>length_error Class Relationship Diagram</h2></a>
<img src="length.gif">
<hr>
<a name="example"></a>
<img src="lego.gif">
<pre>
1
2 #include <stdexcept>
3
4
5 void main(void)
6 {
7
8
9 try{
10
11 exception X;
12 throw(X);
13 }
14 catch(const exception &X)
15 {
16 cout << X.what() << endl;
17
18 }
19
20 try
21 {
22 length_error LengthError("Some Size Error");
23 throw(LengthError);
24 }
25 catch(const exception &X)
26 {
27 cout << X.what() << endl;
28 }
29
30
31
32 }
33
</pre>
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?