C++11新特性之六:list-initialization

在我们实际编程中,我们经常会碰到变量初始化的问题,对于不同的变量初始化的手段多种多样,比如说对于一个数组我们可以使用 int arr[] = {1,2,3}的方式初始化,又比如对于一个简单的结构体:

struct A  
{  
    int x;  
    int y;  
}a={1,2};  

这些不同的初始化方法都有各自的适用范围和作用,且对于类来说不能用这种初始化的方法,最主要的是没有一种可以通用的初始化方法适用所有的场景,因此C++11中为了统一初始化方式,提出了列表初始化(list-initialization)的概念。

一.统一的初始化方法

在C++98/03中我们只能对普通数组和POD(plain old data,简单来说就是可以用memcpy复制的对象)类型可以使用列表初始化,如下:

数组的初始化列表:

 int arr[3] = {1,2,3}

POD类型的初始化列表:

struct A  
{  
    int x;  
    int y;  
}a = {1,2};  

在C++11中初始化列表被适用性被放大,可以作用于任何类型对象的初始化。如下:

class Foo  
{  
public:  
    Foo(int) {}  
private:  
    Foo(const Foo &);  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo a1(123); //调用Foo(int)构造函数初始化  
    Foo a2 = 123; //error Foo的拷贝构造函数声明为私有的,该处的初始化方式是隐式调用Foo(int)构造函数生成一个临时的匿名对象,再调用拷贝构造函数完成初始化  
  
    Foo a3 = { 123 }; //列表初始化  
    Foo a4 { 123 }; //列表初始化  
  
    int a5 = { 3 };  
    int a6 { 3 };  
    return 0;  
}  

由上面的示例代码可以看出,在C++11中,列表初始化不仅能完成对普通类型的初始化,还能完成对类的列表初始化,需要注意的是a3,a4都是列表初始化,私有的拷贝并不影响它,仅调用类的构造函数而不需要拷贝构造函数,a4,a6的写法是C++98/03所不具备的(可以不写等号),是C++11新增的写法。

同时列表初始化方法也适用于用new操作等圆括号进行初始化的地方,如下:

int* a = new int { 3 };  
double b = double{ 12.12 };  
int * arr = new int[] {1, 2, 3};  

让人惊奇的是在C++11中可以使用列表初始化方法对堆中分配的数组进行初始化,而在C++98/03中是不能这样做的。

二.列表初始化的一些细节

虽然列表初始化提供了统一的初始化方法,但是同时也会带来一些使用上的疑惑需要各位苦逼码农注意,比如对下面的自定义类型的例子:

struct A  
{  
    int x;  
    int y;  
}a = {123, 321};  
 //a.x = 123 a.y = 321  
  
struct B  
{  
    int x;  
    int y;  
    B(int, int) :x(0), y(0){}  
}b = {123,321};  
//b.x = 0  b.y = 0  

对于自定义的结构体A来说也是普通的POD类型,使用列表初始化并不会引起问题,x,y都被正确的初始化了,但看下结构体B和结构体A的区别在于结构体B定义了一个构造函数,并使用了成员初始化列表来初始化B的两个变量,因此列表初始化在这里就不起作用了,B采用的是构造函数的方式来完成变量的初始化工作。

那么如何区分一个类(class struct union)是否可以使用列表初始化来完成初始化工作呢?关键问题看这个类是否是一个聚合体(aggregate),首先看下C++中关于类是否是一个聚合体的定义:

(1)无用户自定义构造函数。

(2)无私有或者受保护的非静态数据成员

(3)无基类

(4)无虚函数

(5)无{}和=直接初始化的非静态数据成员。下面我们逐个对上述进行分析。

1、首先存在用户自定义的构造函数的情况,示例如下:

struct Foo  
{  
    int x;  
    int y;  
    Foo(int, int){ cout << "Foo construction"; }  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo{ 123, 321 };  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

输出结果为:Foo construction -858993460 -858993460

可以看出对于有用户自定义构造函数的类使用初始化列表其成员初始化后变量值是一个随机值,因此用户必须以用户自定义构造函数来构造对象。

2、类包含有私有的或者受保护的非静态数据成员的情况

struct Foo  
{  
    int x;  
    int y;  
    //Foo(int, int, double){}  
protected:  
    double z;  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo{ 123,456,789.0 };  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

实例中z是一个受保护的成员变量,该程序直接在VS2013下编译出错,error C2440: 'initializing' : cannot convert from 'initializer-list' to 'Foo',而如果将z变量声明为static则,可以用列表初始化来,示例:

struct Foo  
{  
    int x;  
    int y;  
    //Foo(int, int, double){}  
protected:  
    static double z;  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo{ 123,456};//如果写成Foo foo{123,456,789.0}会提示error C2078: 初始值设定项太多  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

程序输出:123 456,因此可知静态数据成员的初始化是不能通过初始化列表来完成初始化的,它的初始化还是遵循以往的静态成员的初始化方式。

3、类含有基类或者虚函数

struct Foo  
{  
    int x;  
    int y;  
    virtual void func(){};  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo {123,456};  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

上例中类Foo中包含了一个虚函数,该程序也是非法的,编译不过的,错误信息和上述一样cannot convert from 'initializer-list' to 'Foo'。

struct base{};  
struct Foo:base  
{  
    int x;  
    int y;  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo {123,456};  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

上例中则是有基类的情况,类Foo从base中继承,然后对Foo使用列表初始化,该程序也一样无法通过编译,错误信息仍然为cannot convert from 'initializer-list' to 'Foo'。

4、类中不能有{}或者=直接初始化的费静态数据成员

struct Foo  
{  
    int x;  
    int y= 5;  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo {123,456};  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

在结构体Foo中变量y直接用=进行初始化了,因此上述例子也不能使用列表初始化方法,需要注意的是在C++98/03中,类似于变量y这种直接用=进行初始化的方法是不允许的,但是在C++11中放宽了,是可以直接进行初始化的,对于一个类来说如果它的非静态数据成员使用了=或者{}在声明同时进行了初始化,那么它就不再是聚合类型了,不适合使用列表初始化方法了。

在上述4种不再适合使用列表初始化的例子中,需要注意的是一个类声明了自己的构造函数的情形,在这种情况下使用初始化列表是编译器是不会给你报错的,操作系统会给变量一个随机的值,这种问题在代码出BUG后是很难查找到的,因此这种情况不适合使用列表初始化需要特别注意,而其他不适合使用的情况编译器会直接报错,提醒你这些场景下使用列表初始化时不合法的。

那么是否有一种方法可以使得在类不是聚合类型的时候可以使用列表初始化方法呢?相信你肯定猜到了,作为一种很强大的语言不应该也不会存在使用上的限制。自定义构造函数+成员初始化列表的方式解决了上述类是非聚合类型使用列表初始化的限制。看下面的例子:

struct Foo  
{  
    int x;  
    int y= 5;  
    virtual void func(){}  
private:  
    int z;  
public:  
    Foo(int i, int j, int k) :x(i), y(j), z(k){ cout << z << endl; }  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo {123,456,789};  
    cout << foo.x << " " << foo.y;  
    return 0;  
}  

输出结果为 789 123 456 ,可见,尽管Foo中包含了私有的非静态数据以及虚函数,用户自定义构造函数,并且使用成员列表初始化方法可以使得非聚合类型的类也可以使用列表初始化方法,因此在这里给各位看官提个建议,在对类的数据成员进行初始化的时候尽量在类的构造函数中用成员初始化列表的方式来对数据成员进行初始化,这样可以防止一些意外的错误。

三.初始化列表

在上面的使得一个类成为非聚合类的例子2、3、4中,这些非法的用法编译器都报出的错误是cannot convert from 'initializer-list' to 'Foo',那么这个initializer-list是什么呢?为什么使用列表初始化方法是将initializer-list转换成对应的类类型呢?下面我们就来看看这个神秘的东西

1.任何长度的初始化列表

在C++11中,对于任意的STL容器都与未指定长度的数组有一样的初始化能力,如:

int arr[] = { 1, 2, 3, 4, 5 };  
std::map < int, int > map_t { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };  
std::list<std::string> list_str{ "hello", "world", "china" };  
std::vector<double> vec_d { 0.0,0.1,0.2,0.3,0.4,0.5};  

STL容器跟数组一样可以填入任何长度的同类型的数据,而我们自定义的Foo类型却不具备这种能力,只能按照构造函数的成员初始化列表顺序进行依次赋值。实际上之所以STL容易拥有这种可以用任意长度的同类型数据进行初始化能力是因为STL中的容器使用了std::initialzer-list这个轻量级的类模板,std::initialzer-list可以接受任意长度的同类型的数据也就是接受可变长参数{...},那么我们是否可以利用这个来改写我们的Foo类,是的Foo类也具有这种能力呢?看下面例子:

struct Foo  
{  
    int x;  
    int y;  
    int z;  
    Foo(std::initializer_list<int> list)  
    {  
        auto it= list.begin();  
        x = *it++;  
        y = *it++;  
        z = *it++;  
    }  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    Foo foo1 {123,456,789};  
    Foo foo2 { 123, 456};  
    Foo foo3{ 123};  
    Foo foo4{ 123, 456, 789,258 };  
    cout << foo1.x << " " << foo1.y << " " << foo1.z<<endl;  
    cout << foo2.x << " " << foo2.y << " " << foo2.z << endl;  
    cout << foo3.x << " " << foo3.y << " " << foo3.z << endl;  
    cout << foo4.x << " " << foo4.y << " " << foo4.z << endl;  
    return 0;  
}  
输出结果为:
123 456 789  
123 456 -858993460  
123 -858993460 -858993460  
123 456 789  

 在上面的例子中我们用std::initialzer-list将类改写,是的类Foo也具有了接受可变长参数的能力,在Foo类中定义了三个变量,分别在main函数中使用1个、2个、3个、4个参数的列表初始化方法来初始化foo变量,可见,由程序的输出结果可知,对于这种拥有固定数目的数据成员来说使用std::initialzer-list来改写后,如果列表初始化的参数刚好是3个则数据成员完全初始化,如果列表初始化的个数小于3个则未给予的值是一个随机值,而大于3个的话超出的列表初始化参数将被抛弃。虽然std::initialzer-list可以改写我们自定义的类,但是对于用于固定的数据成员的类来说这种改写意义不大,若列表初始化个数少于数据成员个数则会导致某些数据成员未被初始化,容易引起程序出BUG,但是如果我们自定义的类也是一个容器类情况呢?

class FooVec  
{  
public:  
    std::vector<int> m_vec;  
  
    FooVec(std::initializer_list<int> list)  
    {  
        for (auto it = list.begin(); it != list.end(); it++)  
            m_vec.push_back(*it);  
    }  
};  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    FooVec foo1 { 1, 2, 3, 4, 5, 6 };  
    FooVec foo2 { 1, 2, 3, 4, 5, 6, 7, 8, 9 };  
    return 0;  
}  

可见,用std::initialzer-list改写我们自定义的容器类可以使得我们自定义的容器类和STL中的容器类一样拥有接受可变长相同数据类型的数据的能力,注意数据类型必须相同。
std::initialzer-list不仅可以用于自定义类型的列表初始化方法,也可以用于传递相同类型数据的集合:

void func(std::initializer_list<int> list)  
{  
    for (auto it = list.begin(); it != list.end(); it++)  
    {  
        cout << *it << endl;  
    }  
  
}  
int _tmain(int argc, _TCHAR* argv[])  
{  
    func({});//传递一个空集  
    func({ 1, 2, 3 });//传递int类型的数据集  
    return 0;  
}  

因此在以后碰到需要使用可变长度的同类型的数据时,可以考虑使用std::initialzer-list。

2.std::initialzer_list使用细节

简单了解了initialzer-list后,看看它拥有哪些特点呢?

1、它是一个轻量级的容器类型,内部定义了迭代器iterator等容器必须的一些概念。

2、对于initialzer-list<T>来说,它可以接受任意长度的初始化列表,但是元素必须是要相同的或者可以转换为T类型的。

3、它只有三个成员接口,begin(),end(),size(),其中size()返回initialzer-list的长度。

4、它只能被整体的初始化和赋值,遍历只能通过begin和end迭代器来,遍历取得的数据是可读的,是不能对单个进行修改的。

类似下面的操作是不合法的

std::initializer_list<int> list_t ={ 1, 2, 3, 4 };  
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    for (auto it = list_t.begin(); it != list_t.end; it++)  
        (*it) = 1;  
    return 0;  
}  

此外initialzer-list<T>保存的是T类型的引用,并不对T类型的数据进行拷贝,因此需要注意变量的生存期。比如我们不能这样使用:

std::initializer_list<int> func(void)  
{  
    auto a = 2, b = 3;  
    return{ a, b };  
}  

 虽然看起来没有任何问题,且能正常编译通过,但是a,b是在func内定义的局部变量,但程序离开func时变量a,b就销毁了,initialzer-list却保存的是变量的引用,因此返回的将是非法未知的内容。

四.列表初始化防止类型收窄

C++11的列表初始化还有一个额外的功能就是可以防止类型收窄,也就是C++98/03中的隐式类型转换,将范围大的转换为范围小的表示,在C++98/03中类型收窄并不会编译出错,而在C++11中,使用列表初始化的类型收窄编译将会报错:

int a = 1.1; //OK  
int b{ 1.1 }; //error  
  
float f1 = 1e40; //OK  
float f2{ 1e40 }; //error  
  
const int x = 1024, y = 1;  
char c = x; //OK  
char d{ x };//error  
char e = y;//OK
char f{ y };//OK

上面例子看出,用C++98/03的方式类型收窄并不会编译报错,但是将会导致一些隐藏的错误,导致出错的时候很难定位,而利用C++11的列表初始化方法定义变量从源头了遏制了类型收窄,使得不恰当的用法就不会用在程序中,避免了某些位置类型的错误,因此建议以后再实际编程中尽可能的使用列表初始化方法定义变量

原文链接:C++11新特性之六:list-initialization-CSDN博客

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
EurekaLog 7.5 (18-August-2016) 1)..Important: Installation layout was changed. All packages now have version suffix (e.g. EurekaLogCore240.bpl). No files are copied to \bin folder of IDE. Run-time package (EurekaLogCore) is copied to Windows\System32 folder. Refer to help for more info. 2)....Added: RAD Studio 10.1 Berlin support 3)....Added: IDE F1 help integration (on CHM-based IDEs only, i.e. XE8+) 4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL debug info, create .jdbg file, and create .dbg file (Microsoft debug format). Later is supported when map2dbg.exe tool is placed in \Bin folder of EurekaLog installation (separate download is required) 5)....Added: Exception2HRESULT in EAppDLL to simplify developing DLLs with "DLL" profile 6)....Added: Use ShellExecute option for mailto send method 7)....Added: "Mandatory e-mail only when sending" option 8)....Added: Exception line highlighting in disassember view in EurekaLog exception dialog and Viewer 9)....Added: Detection/logging Delphi objects in disassembly view 10)..Added: Support for multi-monitor info 11)..Added: Support for detection of Windows 10 updates 12)..Added: OS edition detection 13)..Added: "User" and "Session" columns to processes list, processes list is also sorted by session first 14)..Added: Support for showing current user processes only 15)..Added: Expanding environment variables for "Support URL" 16)..Fixed: Range-check error on systems with MBCS ACP 17)..Fixed: 64-bit shared memory manager may not work 18)..Fixed: Possible "Unit XYZ was compiled with a different version of ABC" when using packages 19)..Fixed: FastMM shared MM compatibility 20)..Fixed: Minor bugs in stack tracing (which usually affected stacks for leaks) 21)..Fixed: Rare deadlocks in multi-threaded applications 22)..Fixed: Taking screenshot of minimized window 23)..Fixed: NT service may not log all exceptions 24)..Fixed: SSL port number for Bugzilla 25)..Fixed: Disabling "Activate Exception Filters" option was ignored 26)..Fixed: Missing FTP proxy settings 27)..Fixed: IntraWeb support is updated up to 14.0.64 28)..Fixed: Retrieving some process paths in processes list 29)..Fixed: CPU view rendering in EurekaLog exception dialog and Viewer 30)..Fixed: Some issues in naming threads 31)..Fixed: Removed exported helper _462EE689226340EAA982C5E8307B3F9E function (replaced with mapped file) 32)..Changed: Descriptions of EurekaLog project options now list corresponding property names of TEurekaModuleOptions class. 33)..Changed: Default template of HTML/web dialog now includes call stack by default 34)..Changed: EurekaLog 7 now can be installed over EurekaLog 6 automatically, with no additional actions/tools EurekaLog 7.4 (7.4.0.0), 26-January-2016 1)....Fixed: Performance issue in DLL exports debug information provider 2)....Fixed: Range-check error in Send dialog 3)....Fixed: Possible FPU control word unexpected change 4)....Fixed: JIRA sending to project with no version info 5)....Fixed: Viewer sorting affected by local region settings 6)....Fixed: Exception filters ignore settings for restart/terminate EurekaLog 7.3 Hotfix 2 (7.3.2.0), 20-October-2015 1)....Fixed: Added workaround for codegen bug in Delphi 7 (possibly - other), bug manifests itself as wrong date-time in reports or integer overflows 2)....Fixed: Some MAPI DLLs may not be loaded correctly 3)....Fixed: Handling SEC_I_INCOMPLETE_CREDENTIALS in SSPI code (added searching client certificate) 4)....Fixed: Range-check error when closing WinAPI dialog EurekaLog 7.3 Hotfix 1 (7.3.1.0), 2-October-2015 1)....Fixed: Long startup time on terminal services servers EurekaLog 7.3 (7.3.0.0), 24-September-2015 1)....Added: RAD Studio 10 Seattle support 2)....Added: Performance counters for run-time (internal logging with --el_debug) 3)....Fixed: spawned by ecc32/emake processes now start with the same priority 4)....Fixed: ThreadID = 0 in StandardEurekaNotify 5)....Fixed: Dialog auto-close timer may reset without user input 6)....Fixed: Possible hang when quickly loading/unloading EurekaLog-enabled DLL 7)....Fixed: Possible hang in COM DLLs 8)....Fixed: Removed some unnecessary file system access on startup 9)....Fixed: Possible wrong font size in EurekaLog tools 10)..Fixed: Ignore timeouts from Shell_NotifyIcon 11)..Fixed: Possible failure to handle/process stack overflow exceptions 12)..Changed: VCL/CLX/FMX now will assign Application.OnException handler when low-level hooks are disabled EurekaLog 7.2 Hotfix 6 (7.2.6.0), 14-July-2015 1)....Added: csoCaptureDelphiExceptions option 2)....Fixed: Handling of SECBUFFER_EXTRA in SSPI code 3)....Fixed: Several crashes in sending code for very old Delphi versions 4)....Fixed: Regression (from hotfix 5) crash in some IDEs EurekaLog 7.2 Hotfix 5 (7.2.5.0), 1-July-2015 1)....Added: HKCU\Software\EurekaLab\Viewer\4.0\UI\Statuses registry key to allow status customizations in Viewer 2)....Added: "Disable hang detection under debugger" option 3)....Fixed: Wrong button caption in standalone "Steps to reproduce" dialog 4)....Fixed: Wrong passing of Boolean parameters in JSON (affects JIRA) 5)....Fixed: Wrong sorting of BugID, Count and DateTime columns in Viewer 6)....Fixed: Empty "Count" field/column is now displayed as "1" in Viewer 7)....Fixed: Generic names with "," could not be decoded in Viewer 8)....Fixed: Updated Windows 10 detection for latest builds of Windows 10 9)....Fixed: Sleep and hybernation no longer trigger false-positive "application freeze" 10)..Fixed: Wrong function codes for hooking (affects ISAPI application type) 11)..Fixed: Wrong button caption in "Steps to Reproduce" dialog 12)..Fixed: Crash when taking snapshot of some proccesses by Threads Snapshot tool 13)..Fixed: Minor improvements in leak detection EurekaLog 7.2 Hotfix 4 (7.2.4.0), 10-June-2015 1)....Added "ECC32TradeSpeedForMemory" option - defaults to 0/False, could be changed to 1 via Custom/Manual tab. This option will switch from fast-methods to slower methods, but which take less memory. Use 0 (default) for small projects, use 1 for large projects (if ecc32 runs out of memory). 2)....Added: --el_DisableDebuggerPresent command-line option for compatibility with 3rd party debuggers (AQTime, etc.) 3)....Added: AQTime auto-detect 4)....Fixed: Performance optimizations 5)....Fixed: Windows 8+ App Menu shortcuts 6)....Fixed: Unmangling on x64 EurekaLog 7.2 Hotfix 3 (7.2.3.0), 20-May-2015 1)....Added: Support for token auth in Bugzilla (latest 4.x builds) 2)....Added: Support for API key auth in Bugzilla (5.x) 3)....Added: Support for /EL_DisableMemoryFilter command-line option 4)....Added: Asking e-mail when user switches to "details" from MS Classic without entering e-mail 5)....Fixed: Compatibility issues with older Bugzilla versions (3.x) 6)....Fixed: Passing settings between dialogs 7)....Fixed: "Ask for steps to reproduce" dialog is now DPI-aware 8)....Fixed: Silently ignore and fix invalid values in project options EurekaLog 7.2 Hotfix 2 (7.2.2.0), 30-April-2015 1)....Fixed: Confusing message in Manage tool when using with Trial/Pro 2)....Fixed: Range check error in processes information for x64 machines (affects startup of any EurekaLog-enabled module) 3)....Fixed: Auto-detect personality by project extension if --el_mode switch is missing 4)....Fixed: More details for diagnostic sending 5)....Fixed: Wrong settings for MAP files in C++ Builder 6)....Fixed: Wrong code page was used to decode ANSI bug reports 7)....Fixed: Attaching .PAS files instead of .OBJ in C++ Builder 2006+ Pro/Trial EurekaLog 7.2 Hotfix 1 (7.2.1.0), 3-April-2015 1)....Fixed: Wrong float-str convertion when ThousandSeparator is '.' EurekaLog 7.2 (7.2.0.0), 1-April-2015 1)....Important: TEurekaLogV7 component was renamed to TEurekaLogEvents. Please, update your projects by renaming or recreating the component 2)....Important: File layout was changed for BDS 2006+. Delphi and C++ Builder files are now located in StudioNum folders instead of old DelphiNum and CBuilderNum folders. Update your search paths if needed 3)....Added: Major improvements in DumpAllocationsToFile function (EMemLeaks unit) 4)....Added: MemLeaksSetParentBlock, MemLeaksOwn, EurekaTryGetMem functions (EMemLeaks unit) 5)....Added: Improvements for call stack of dynarrays/strings allocations (leaks) 6)....Added: "Elem size" when reporting leaks in dynarrays 7)....Added: Streaming unpacked debug info into temporal files instead of memory - this greatly reduces run-time application memory usage at cost of slightly slower exception processing. This also reduces memory footprint for ecc32/emake 8)....Added: Showing call stacks for 2 new types of fatal memory errors 9)....Added: EMemLeaks._ReserveOutOfMemory to control reserve size of out of memory errors (default is 50 Mb) 10)..Added: "MinLeaksLimitObjs" option (EMemLeaks unit) 11)..Added: Fatal memory problem now pauses all threads in application 12)..Added: Fatal memory problem now change thread name (to simplify debugging) 13)..Added: boPauseELThreads and boDoNotPauseELServiceThread options (currently not visible in UI) 14)..Added: Support for texts collections out of default path 15)..Added: Support for relative file paths to text collections and external settings 16)..Added: Support for environment variables in project option's paths 17)..Added: Support for relative file paths and environment variables for events and various module paths 18)..Added: Logging in Manage tool 19)..Added: Windows 10 version detection 20)..Added: Stack overflow tracing 21)..Added: Major improvements in removal of recursive areas from call stack 22)..Added: Statistics collection 23)..Added: Support for uploading multiple files in JIRA 24)..Added: EResLeaks improvements (new funcs: ResourceAdd, ResourceDelete, ResourceName; support for realloc-like functions) 25)..Fixed: Added workaround for bug in JIRA 5.x 26)..Fixed: Rare EurekaLog internal error 27)..Fixed: Ignored unhandled thread exceptions (when EurekaLog is disabled) now triggers default OS processing (WER) 28)..Fixed: Irnored exceptions (via per-exception/events) now bring up default RTL handler 29)..Fixed: Format error in Viewer 30)..Fixed: Leak of EurekaLog exception information object 31)..Fixed: Wrong chaining exceptions inside GetMem/FreeMem 32)..Fixed: Memory leak after low-level unhook of function 33)..Fixed: Re-parenting after ReallocMem 34)..Fixed: Editing SMTP server options 35)..Fixed: SMTP server not using real user e-mail in FROM field 36)..Fixed: Some multi-threading crashes 37)..Fixed: Fixed crashes in Manage tool 38)..Fixed: Range-check error in Viewer 39)..Fixed: EurekaLog error dialog appearing under other windows 40)..Fixed: AV when parsing TDS (emake/C++ Builder specific) 41)..Fixed: Unable to build call stacks for other threads due to insufficient rights 42)..Fixed: Version checks for BugZilla and JIRA 43)..Fixed: Not catching out-of-module AVs when "Capture exceptions only from current module" option is checked 44)..Fixed: Checking for remaining exceptions at shutdown (C++ Builder specific, AcquireExceptionObject returns wrong info) 45)..Fixed: "get call stack of ... threads" / "suspend ... threads" options (avoid rare multithreading race conditions) 46)..Fixed: Crash when naming thread without EurekaLog thread info 47)..Fixed: Detection of immediate caller for memory funcs 48)..Fixed: Non-working Assign for options 49)..Fixed: Handling of explicitly chained exceptions 50)..Fixed: Various exception/threading fixes for MS debug provider 51)..Fixed: Processing hardware unhandled exceptions (QC #55007) 52)..Fixed: Unchecking dialog options when export/import 53)..Fixed: BSTR leak 54)..Fixed: JIRA decimal separator bug 55)..Changed: Now unhandled exceptions will be handled by EurekaLog even if EurekaLog is disabled in the thread - only global EurekaLog-enabled status is respected 56)..Changed: Viewer version now matches version of EurekaLog 57)..Changed: DeleteServiceFilesOption now always False by default 58)..Changed: Speed improvements for known memory leaks (reserved leaks) 59)..Changed: Improved logging for sending 60)..Changed: Switching to detailed mode without entering (mandatory) e-mail: now EL will not block this 61)..Changed: .ToString for exception info now uses compact stack formatter 62)..Removed: Custom field editor (replaced it with link to "Custom" page) 63)..Removed: EurekaLog 7 no longer could be installed over EurekaLog 6. Manage tool from EurekaLog 7 will no longer work with EurekaLog 6. EurekaLog 7.1 update 1 (7.1.1.0), 19-October-2014 1)....Added: "Send in separated thread" option 2)....Added: Hang detection will now use Wait Chain Traversal (WCT) on Vista+ systems to detect deadlocks in any EurekaLog-enabled threads 3)....Added: OS install language and UI language fields in bug report 4)....Fixed: Viewer is not able to decrypt reports with generics 5)....Fixed: EVariantTypeCastError in Viewer when changing status of some bug reports 6)....Fixed: EcxInvalidDataControllerOperation in Viewer 7)....Fixed: Stack overflow at run-time for certain combination of project options 8)....Fixed: BMP re-draw bug in UI dialogs 9)....Fixed: Rogue "corrupted" error message for valid ZIPs of certain structure 10)..Fixed: Various range check errors in Viewer 11)..Fixed: Possible encoding errors for non-ASCII reports in Viewer on certain environments 12)..Fixed: Wrong count in Viewer when importing reports without proper "count" field 13)..Fixed: Duplicate reports may appear in bug report file when "Do not save duplicate errors" option is checked 14)..Fixed: False-positive detection of some virtual machines 15)..Fixed: Processing of exceptions from message handlers during message pumping cycle inside exception dialogs 16)..Fixed: Access Violation if exception dialog was terminated by exception 17)..Fixed: Hardware exceptions from unit's initialization/finalization may be unprocessed 18)..Changed: "VIEW" action for Viewer now will open ALL bug reports inside bug report file; reports will not be merged by BugID. "IMPORT" action remains the same: duplicate reports are merged, "count" is increased 19)..Changed: Charset field in bug report now shows both charset and code page EurekaLog 7.1 (7.1.0.00), 23-September-2014 1)....Added: XE7 support 2)....Added: XE6 support 3)....Added: New DLL demo 4)....Added: Custom profiles are now shown in "Application type" combo-box 5)....Added: Non-empty "steps to reproduce" will be added to existing bug tracker issues with empty "steps to reproduce" 6)....Added: Support for custom fields in FogBugz (API version 8 and above) 7)....Added: Support for unsequenced line numbers in PDB/DBG files (--el_source switch) 8)....Fixed: XML bug report were generated wrong 9)....Fixed: Strip relocations code for Win64 10)..Fixed: EurekaLog conditional symbols removed improperly when deactivating EurekaLog 11)..Fixed: Sending reports to non-default port numbers (affects web-based methods) 12)..Fixed: SSL validation check may reject valid SSL certificate (SMTP Client/Server) 13)..Fixed: SSL errors may be not reported 14)..Fixed: Viewer did not consider empty bug reports as corrupted 15)..Fixed: "DLL" profile now can be used with packages properly 16)..Fixed: Few rare memory leaks 17)..Fixed: Possible deadlock when using MS debug info provider 18)..Fixed: C++ Builder project files was saved incorrectly (RAD Studio 2007+) 19)..Fixed: "Show restart checkbox after N errors" counts handled exceptions 20)..Fixed: IDE expert's DPR parser (added support for multi-part idents) 21)..Fixed: Rare access violation in hook code 22)..Fixed: Thread handle leaks (added _NotifyThreadGone/_CleanupFinishedThreads functions to be called manually - only when low-level hooks are not installed) 23)..Fixed: EurekaLog's installer hang 24)..Fixed: Bug in object/class validation 25)..Fixed: Bug when using TThreadEx without EurekaLog 26)..Fixed: Leaks detection may not work with certain combination of options 27)..Fixed: Deadlock in some cases when using EurekaLog threading option set to "enabled in RTL threads, disabled in Windows threads". 28)..Changed: TEurekaExceptionInfo.CallStack will be nil until exception is actually raised 29)..Changed: FogBugz and BugZilla: changed bugs identification within project (to allow two bugs exists with same BugID in different projects) 30)..Changed: Blocked manual creation/destruction of ExceptionManager class and EurekaExceptionInfo 31)..Changed: ECC32/EMAKE runs from IDE without changing priority, added ECC32PriorityClass option 32)..Improved: Minor help and text improvements EurekaLog 7.0.07 Hotfix 2 (7.0.7.2), 11-December-2013 1)....Fixed: Delphi compiler code generation bug (Delphi 2007 and below) 2)....Fixed: Code hooks may rarely be set incorrectly (code stub relocation fails) 3)....Fixed: Win64 call stacks functions now work more similar to 32 bit call stacks EurekaLog 7.0.07 Hotfix 1 (7.0.7.1), 2-December-2013 1)....Added: Alternative caption for e-mail input control when e-mail is mandatory 2)....Fixed: Rare range check error in WinAPI visual dialogs 3)....Fixed: Wrong error detection for OnExceptionError event 4)....Fixed: Wrong TResponce processing 5)....Fixed: Problems with encrypted call stack decoding 6)....Fixed: OnPasswordRequest event may have no effect EurekaLog 7.0.07 (7.0.7.0), 25-November-2013 1)....Added: Ability to use Assign between call stack and TStrings 2)....Added: 64-bit disassembler 3)....Added: Support for variables and relative file paths in "Additional Files" send option 4)....Added: --el_source switch for ecc32/emake compilers 5)....Added: support for post-processing non-Embarcadero executables 6)....Added: EOTL.pas unit for better OmniThreadLibrary integration 7)....Added: RAD Studio XE5 support 8)....Added: New "Capture call stacks of EurekaLog-enabled threads" option 9)....Added: "Deferred call stacks" option for 64-bit 10)..Added: Copy report to clipboard now copies both report text and report file 11)..Added: "AttachBothXMLAndELReports" option to include both .elx and .el files into bug report 12)..Added: EMemLeaks.MemLeaksErrorsToIgnore option to exclude certain memory errors from being considered as fatal 13)..Added: Call stack with any encrypted entry will be fully encrypted now 14)..Added: Option to exclude certain memory errors from being considered as fatal (EMemLeaks.MemLeaksErrorsToIgnore) 15)..Added: New "HTTP Error Code" option for all web-based dialogs (CGI, ISAPI, etc.) 16)..Added: Support for Unicode in Simple MAPI send method (requires Windows 8 or latest Microsoft Office) 17)..Added: New value for call stack detalization option (show any addresses, including those not belonging to any executable module) 18)..Fixed: Wrong JSON escaping for strings (affects JIRA send method) 19)..Fixed: Range-check error in Viewer when viewing bug reports with high addresses 20)..Fixed: Selecting Win32 service application type is no longer resets to custom/unsupported 21)..Fixed: Possible hang when testing dialogs from EurekaLog project options dialog 22)..Fixed: Rare resetting of some options when saving .eof file 23)..Fixed: Exception pointer could be removed from call stack due to debug details filtering 24)..Fixed: Rare case when LastThreadException returned nil while there was active thread exception 25)..Fixed: Rare case when ShowLastThreadException do nothing 26)..Fixed: Improved compatibility for OmniThreadLibrary and AsyncCalls 27)..Fixed: Included fix for QC #72147 28)..Fixed: 64-bit MS Debug Info Provider (please, re-setup cache options using configuration dialog) 29)..Fixed: "Deferred call stacks" option failed to capture call stack when exception is re-raised between threads 30)..Fixed: "Deferred call stacks" option may produce cutted call stack in rare cases 31)..Fixed: Several minor call stacks improvements and optimizations 32)..Fixed: Several 64-bit Pointer Integer convertion issues 33)..Fixed: Multi-threading deadlock issue 34)..Fixed: Black screenshots in 64 bit applications 35)..Fixed: Copying to clipboard hot-key was registered globally 36)..Fixed: Shell (mailto) send method may fail (64 bit) 37)..Fixed: Possible wrong file paths for attaches in (S)MAPI send methods 38)..Fixed: Environment variables were not expanded in MAPI send method 39)..Fixed: (non-Unicode IDE) EurekaLog is not activated when application started from folder with Unicode characters 40)..Fixed: Encrypted call stacks may be encrypted partially by EurekaLog Viewer in rare cases 41)..Fixed: Crash when sending leak report with visual progress dialog (only some IDEs are affected) 42)..Fixed: ecc32/emake could not see external configuration file with the same name as project (e.g. Project1.eof for Project1.dpr) 43)..Fixed: Added missed RTL implementation for ExternalProps in Delphi 6 (affects Mantis sending) 44)..Fixed: IDE crash when switching to threads window 45)..Changed: Removed temporal solution which was used before option to defer call stack creation was introduced 46)..Changed: "Default EurekaLog state in new threads" option is changed from Boolean flag into enum. You need to re-setup this option 47)..Changed: Disable EurekaLog for thread when creating call stack or handle exception - this increases stability and performance 48)..Changed: LastException property is remove from exception manager as not thread safe. Use LastThreadException property instead 49)..Changed: Lock/Unlock from thread manager and exception manager are removed to avoid deadlocks 50)..Changed: ThreadsSnapshot tool now tries to capture call stack without injecting DLL 51)..Changed: Build events now runs with CREATE_NO_WINDOW flag (console window is hidden) 52)..Improved: More articles in help EurekaLog 7.0.06 (7.0.6.0), 1-June-2013 1)....Added: Experimental 64 bit C++ Builder support 2)....Added: New tab in EurekaLog project options: "External tools" 3)....Added: Option to catch all IDE errors (to debug your own IDE packages) 4)....Added: Option to catch only exceptions from current module 5)....Added: Option to defer building call stack 6)....Added: RAD Studio XE4 support 7)....Added: Support for AppWave 8)....Fixed: Fixed event handlers declarations for the EurekaLog component 9)....Fixed: Infinite recursive calls when using ToString from EndReport event handler 10)..Fixed: UPX compatibility issue 11)..Fixed: Range check errors for system error codes 12)..Fixed: Rare IDE stack overflow 13)..Fixed: JIRA unit was not added automatically 14)..Fixed: EurekaLog no longer tries to check for leaks when memory manager filter is disabled 15)..Fixed: Possible deadlock on shutdown with freeze checks active 16)..Fixed: Issues with settings dialog and Win32 Service application type 17)..Fixed: ThreadSnapshot tool was not able to take snapshots of Win64 processes 18)..Fixed: WCT is disabled for leaks 19)..Fixed: TContext declarations for Win64 20)..Fixed: Check for updates now correctly sets time of last check 21)..Fixed: (Win64) Several Pointer Integer convertion errors 22)..Fixed: Internal error when exception info object was deleted while it was still used by SysUtils exception object 23)..Fixed: Semeral problems with "EurekaLog look & feel" style for EurekaLog error dialog 24)..Fixed: Using text collection resets exception filters 25)..Fixed: Rare access violation if registering event handlers is placed too early 26)..Fixed: SMTP RFC date formatting 27)..Fixed: Rare empty call stack bug 28)..Fixed: Hang detection was not working if EurekaLog was disabled in threads 29)..Fixed: AV for double-free TEncoding 30)..Changed: ecc32/emake no longer alters arguments for dcc32/make unless new options --el_add_default_options is specified 31)..Changed: Save/load options methods was moved to TEurekaModuleOptions class 32)..Changed: Saving options to EOF file now adds hidden options and removes obsolete options (only when compatibility mode is off) 33)..Changed: Compiling installed packages now silently ignores EurekaLog instead of showing "File is in use" error message 34)..Improved: More readable disk/memory sizes in bug reports 35)..Improved: More descriptive settings dialog when using external configuration 36)..Improved: ThreadSnapshot tool now aquired DEBUG priviledge for taking snapshot. This allows it to bypass security access checks when opening target process. 37)..Improved: Changed BugID default generation to include error code for OS errors and error message for DB errors 38)..Improved: Mantis API (WSDL) was updated to the latest version (1.2.14) 39)..Improved: IntraWeb compatibility (old and new versions) 40)..Improved: COM applications compatibility 41)..Improved: Build events now accept shell commands 42)..Improved: More articles in help EurekaLog 7.0.05 (7.0.5.0), 7-February-2013 1)....Added: JIRA support 2)....Added: Virtual machine detection (new field in bug reports) 3)....Fixed: "Use Main Module options" option was loading empty options for some cases 4)....Fixed: Wrong record declarations for Simple MAPI on Win64 5)....Fixed: Performance issues with batch module options updating 6)....Fixed: Wrong leaks report with both MemLeaks/ResLeaks options active 7)....Fixed: Wrong info for nested exceptions in some cases 8)....Fixed: AV under debugger for Win64 (added support for _TExitDllException) 9)....Fixed: Wrong record declarations for process/thread info on Win64 10)..Fixed: Support for FinalBuilder on XE2/XE3 with spaces in file paths 11)..Fixed: Rare double-free of module information (ModuleInfoList) 12)..Fixed: Rare External Exception C000071C on shutdown (only under debuggger) 13)..Fixed: Added large addresses support in Viewer 14)..Fixed: Counter options in memory leaks category is now working properly 15)..Fixed: Rare range-check error in TEurekaModulesList.AddModuleFromFileName 16)..Fixed: FTP force directories dead lock 17)..Fixed: Fixed wrong index being used when clearing compatibility mode (EurekaLog project options dialog) 18)..Fixed: Default thread state do not affect main thread now 19)..Fixed: Sometimes wrong thread may be used when altering EurekaLog active state for external thread 20)..Fixed: Wrong DNS lookup on ANSI 21)..Fixed: Problems with IDE expert and projects on network paths 22)..Fixed: Added support for arguments in URLs (HTTP sending) 23)..Fixed: Possible deadlock in multithreaded applications 24)..Fixed: Problems with unicode characters in project files on non-Unicode IDEs 25)..Fixed: Infinite recursive calls when using ToString from EndReport event handler 26)..Fixed: Win64 GetCaller now returns pointer to call instruction, not return address 27)..Improved: Standalone Editor do not force save/load folder by default 28)..Improved: DLL profile now can use additional application type hooks automatically 29)..Improved: EurekaLog now able to work with read-only projects (see help for more info) EurekaLog 7.0.04 (7.0.4.0), 2-December-2012 1)....Added: Support for nested exceptions in DLLs 2)....Fixed: Options bug in EurekaLogSendEmail function 3)....Fixed: Weird behaviour for steps to reproduce and custom fields 4)....Fixed: Installation for single personality (BDS) 5)....Fixed: Range check error in EModules 6)....Fixed: Bug in exception destroy hook 7)....Fixed: OnExceptionNotify event is no longer called for handled exceptions without option checked 8)....Fixed: DEP checks on startup no longer cause exception 9)....Fixed: Invalid declaration for MS Debug API 10)..Fixed: OLE mode change error for "Test" send button 11)..Fixed: Fixes for multiply loading of the same DLL 12)..Fixed: Removed PNG compression from icons (tools) 13)..Fixed: Range-check error in dialogs with EurekaLog style enabled 14)..Fixed: Send progress dialog may keep busy forever processing window messages (message flood from rapid application GUI updates) 15)..Fixed: Thread pausing options now work correctly 16)..Improved: New features in exception filters - marking exceptions as "expected", filtering by properties (RTTI) 17)..Improved: Recovery from memory errors without debugging memory manager 18)..Improved: Viewer's password edit now hides password with asterisks 19)..Updated: Changed names of .inc files to avoid name conflicts with other libraries 20)..Updated: Help EurekaLog 7.0.03 (7.0.3.0), 6-October-2012 1)....Fixed: Removed some consts keywords for event handlers, so now C++ Builder can alter arguments (this change may require you to adjust your custom code) 2)....Fixed: Fallback code for false-positive results on memory probing 3)....Fixed: Range check errors in SSL/TLS implementation 4)....Fixed: "EurekaLog is not active" error message during send testing 5)....Fixed: Incorrect memory probing when DEP is off (old systems) 6)....Fixed: Installation of 64-bit BPLs 7)....Fixed: Dialog preview 8)....Fixed: Win64 fixes for XE3 9)....Fixed: Support for project groups (mixed project types) 10)..Fixed: Windows 2000 hooks compatibility 11)..Fixed: mailto double quotes escaping 12)..Fixed: Simple MAPI WOW compatibility 13)..Fixed: Simple MAPI modal issues 14)..Fixed: Various range check errors 15)..Changed: Removed minor version number from program group name 16)..Updated: Help EurekaLog 7.0.02 hot-fix 1 (7.0.2.1), 12-September-2012 1)....Fixed: Range check error in Viewer 2)....Fixed: Bug in hooking code EurekaLog 7.0.02 (7.0.2.0), 11-September-2012 1)....Added: Improved memory problems detection 2)....Added: Minor IDE Expert usability improvements 3)....Added: Auto-size feature for detailed error dialog 4)....Added: Workaround for QC #106935 5)....Added: Workaround for bug in InvokeRegistry (SOAP/Mantis) 6)....Fixed: Nested OS exceptions 7)....Fixed: Multiply Win64 fixes 8)....Fixed: Compatibility mode fixes 9)....Fixed: Altered behaviour of "Add BugID/Date/ComputerName" options 10)..Fixed: Blank screenshots 11)..Fixed: Check file for corruptions 12)..Fixed: Viewer is unable to decrypt certain bug reports 13)..Fixed: Internal DoNoTouch option now works for post-processing and condtionals 14)..Fixed: Possible out of memory error for "Do not store class/procedure names" option 15)..Fixed: EurekaLog did not properly install itself when there is only Delphi installed, but no C++ Builder of the same version (or visa versa) 16)..Fixed: Wrong argument for OnRaise event 17)..Fixed: Handling memory errors in initialization/finalization sections 18)..Fixed: Updating steps to reproduce and user e-mail in bug report 19)..Fixed: Proper Success/Failure for some errors during SMTP send 20)..Added: Workaround for wrong GUI fonts 21)..Added: Delphi XE3 support 22)..Added: Individual options for each exception EurekaLog 7.0.01 (7.0.1.0), 28-June-2012 1)....Added: New "Modal window" option (MS Classic and EurekaLog dialogs) 2)....Added: New "Owned window" option (MS Classic and EurekaLog dialogs) 3)....Added: New "Catch EurekaLog IDE Expert errors" option 4)....Added: Backup memory manager to recover from critical errors 5)....Added: Alternative methods to provide additional features when memory filter is not set 6)....Fixed: Contains fixes from hotfixes 1-3 7)....Fixed: Performance improvements 8)....Fixed: Improved IDE Expert's speed, stability and compatibility with other 3rd party extensions 9)....Fixed: MS Classic dialog size adjustments for large "click here" translations 10)..Fixed: Fixed resetting few EurekaLog project options to defaults 11)..Fixed: Multiplying exception filters when options are assigned (for example: when switching to/from "Custom" page in project options) 12)..Fixed: (Compatibility mode) Fixed send options merging 13)..Fixed: Updated help EurekaLog 7.0 hot-fix 3 (7.0.0.273), 20-June-2012 --------------------------- 1)....Fixed: ERangeError in EResLeaks (THandle Integer) 2)....Fixed: C++ Builder breakpoints for large projects 3)....Fixed: Help (updates policy changed) 4)....Fixed: Text collections applying 5)....Fixed: Build events are now called for unlocked file 6)....Fixed: Proper handling of C++ Builder project options files from Delphi code (settings editor and IDE expert) 7)....Fixed: Terminate/Checked sub-option for MS Classic dialog 8)....Fixed: Confusing message for already post-processed executables 9)....Fixed: Access violation for some EurekaLog IDE menu items when no project was loaded 10)..Fixed: Invoking help for "Variables" window 11)..Fixed: EurekaLog Viewer version info 12)..Fixed: Events in components 13)..Added: Retry option for "Sorry, you must close all running IDE instances before installation" 14)..Added: Italian translation 15)..Added: Actual change log is now included into installer 16)..Added: Even more setup logging 17)..Added: New help articles (recompilation and manual installation) EurekaLog 7.0 hot-fix 2 (7.0.0.261), 10-June-2012 --------------------------- 1)....Fixed: Wrong version info reporting to IDE 2)....Added: Workaround for Delphi 2005 TListView bug 3)....Added: Workaround for possible invalid FPU state in exception handlers 4)....Added: Missed declarations for ExceptionLog (compatibility mode) 5)....Fixed: Work for unsaved projects 6)....Added: Escaping for '--' in options (confuses IDE's XML parsing) 7)....Added: Storing thread's class/name in call stack for terminated threads 8)....Added: More setup logging 9)....Fixed: Help (broken links) 10)..Added: "Upgrade to EurekaLog 7" help topic 11)..Fixed: Clean up installed files EurekaLog 7.0 hot-fix 1 (7.0.0.256), 6-June-2012 --------------------------- 1)....Fixed: Invalid Format() arguments in ELogBuilder. EurekaLog 7.0, 1-June-2012 --------------------------- 1)....Improved: Main change - EurekaLog's core was rewritten (refactored) to allow more easy modification and remove hacks. 2)....Improved: New plugin-like architecture now allows you to exclude unused code. 3)....Improved: New plugin-like architecture now allows you to easily extends EurekaLog. 4)....Improved: Greatly extended documentation. 5)....Improved: Installer is now localized. 6)....Improved: Greatly speed ups creation of minimal bug report (with most information disabled). 7)....Changed: EurekaLog's root IDE menu was relocated to under Tools and extended with new items. 8)....Added: New examples. 9)....Added: New tools (address lookup, error lookup, threads snapshot, standalone settings editor). 10)..Added: Support for DBG/PDB formats of debug information (including symbol server support and auto-downloading). 11)..Added: Support for madExcept debug information (experimental). 12)..Added: WER (Windows Error Reporting) support. 13)..Added: Full unicode support. 14)..Added: Professional and Trial editions: added source code (interface sections only) 15)..Improved: Dialogs - new options and new customization possibilities: 16)..Added: All GUI dialogs: ability to test dialog directly from configuration dialog by displaying a sample window with currently specified settings. 17)..Improved: All GUI dialogs: dialogs are DPI-awared now (auto-scale for different DPI). 18)..Added: MessageBox dialog: added detailed mode (shows a compact call stack). 19)..Added: MessageBox dialog: added ability for asking a send consent. 20)..Added: MessageBox dialog: added support to switch to "native" message box for application. 21)..Added: MS Classic dialog: added control over "user e-mail" edit's visibility. 22)..Added: MS Classic dialog: added ability to personalize dialog view with application's name and icon. 23)..Added: MS Classic dialog: added ability to show terminate/restart checkbox initially checked. 24)..Added: EurekaLog dialog: added ability to personalize dialog view with application's name and icon. 25)..Added: EurekaLog dialog: added ability to show terminate/restart checkbox initially checked. 26)..Added: EurekaLog dialog: added ability to switch back to non-detailed view. 27)..Added: WEB dialog: added new tags to customize bug report page. 28)..Improved: WEB dialog: improved support for unicode and charset. 29)..Added: New dialog type: RTL dialog. 30)..Added: New dialog type: console output. 31)..Added: New dialog type: system logging. 32)..Added: New dialog type: Windows Error Reporting. 33)..Improved: Sending - new options and new customization possibilities: 34)..Added: All send methods: added ability to setup multiply send methods. 35)..Added: All send methods: added ability to change send method order. 36)..Added: All send methods: added separate settings for each send method. 37)..Added: All send methods: ability to test send method directly from configuration dialog by sending a demo bug report. 38)..Added: SMTP client send method: added SSL support. 39)..Added: SMTP client send method: added TLS support. 40)..Added: SMTP client send method: added option for using real e-mail address. 41)..Added: SMTP server send method: added option for using real e-mail address. 42)..Added: HTTP upload send method: added support for custom backward feedback messages. 43)..Added: FTP upload send method: added creating folders on FTP (like remote ForceDirectories). 44)..Added: Mantis send method: added API support (MantisConnect, out-of-the-box since Mantis 1.1.0, available as add-on for previous versions). 45)..Added: Mantis send method: added support for custom "Count" field. 46)..Added: Mantis send method: added options for controlling duplicates. 47)..Added: Mantis send method: added support for SSL/TLS. 48)..Added: FogBugz send method: added API support (out-of-the-box since ForBugz 7, available as add-on for FogBugz 6). 49)..Added: FogBugz send method: EurekaLog will update "Occurrences" field (count of bugs). 50)..Added: FogBugz send method: EurekaLog will respect "Stop reporting" option (BugzScout's setting). 51)..Added: FogBugz send method: EurekaLog will respect "Scout message" option (BugzScout's setting). 52)..Added: FogBugz send method: EurekaLog will store client's e-mail as issue's correspondent. 53)..Added: FogBugz send method: added options for controlling duplicates. 54)..Added: FogBugz send method: added support for "Area" field. 55)..Added: FogBugz send method: added support for SSL/TLS. 56)..Added: BugZilla send method: added API support. 57)..Added: BugZilla send method: added support for custom "Count" field. 58)..Added: BugZilla send method: added options for controlling duplicates. 59)..Added: BugZilla send method: added support for SSL/TLS. 60)..Added: New send method: Shell (mailto protocol). 61)..Added: New send method: extended MAPI. 62)..Added: Support for separate code and debug info injection. 63)..Added: Ability to use custom units before EurekaLog's units. 64)..Added: Support for external configuration file in IDE expert. 65)..Added: Now EurekaLog stores only those project options which are different from defaults (to save disk space and reduce noise in project file). 66)..Added: Now EurekaLog stores project options sorted (alphabet order). 67)..Added: Separate settings for saving modules and processes lists to bug report. 68)..Added: Support for taking screenshots of multiply monitors. 69)..Added: More screenshot customization options. 70)..Added: More control over bug report's file names. 71)..Added: New environment variables. 72)..Added: Deleting .map file after compilation. 73)..Added: Support for different .dpr and .dproj file names. 74)..Improved: memory leaks detection feature - new options and new customization possibilities: 75)..Added: Ability to track memory problems without activation of leaks checking. 76)..Added: Support for sharing memory manager. 77)..Added: Support for tracking leaks in applications built with run-time packages. 78)..Added: Option to zero-fill freed memory. 79)..Added: Option to enable leaks detection only when running under debugger. 80)..Added: Option for manual activation control for leaks detection (via command-line switches). 81)..Added: Option to select stack tracing method for memory problems. 82)..Added: Option to trigger memory leak reporting only for large leaked memory's size. 83)..Added: Option to control limit of number of reported leak. 84)..Added: CheckHeap function to force check of heap's consistency. 85)..Added: DumpAllocationsToFile function to save information about allocated memory to log file. 86)..Added: Registered leaks feature. 87)..Added: Run-time control over memory leak registering. 88)..Added: New recognized leak type: String (both ANSI and Unicode are supported). 89)..Added: Memory features support for C++ Builder. 90)..Added: Resource leaks detection feature. 91)..Improved: Compilation speed increased. 92)..Added: Support for generics in debug information. 93)..Added: Chained/nested exceptions support. 94)..Added: Wait Chain Traversal support. 95)..Added: Support for named threads. 96)..Added: Additional information for threads in call stack. 97)..Improved: EurekaLog Viewer Tool: 98)..Added: Now Viewer has its own help file 99)..Added: Viewer now supports a FireBird based database on local file or remote server. 100).Added: You can have more that one user account for FireBird based database. 101).Added: Viewer now can be launched in View mode (Viewer can be configured to any DB or View mode). 102).Added: Viewer's database now supports storing files, associated with the report (you can also add and remove files manually). 103).Added: Viewer supports "Import" and "View" commands for report files. 104).Improved: Extended support for more log formats (XML, packed ELF, etc). 105).Added: Columns in report's list now can be configured (you can hide and show them). 106).Added: There are a plenty of new columns added to report's list. 107).Added: Ability of auto-download reports from e-mail account. 108).Improved: printing - now you can print the entire report (including screenshots). Old behaviour of printing just one tab (call stack only, for example) also remains. 109).Added: Viewer can now have more that one run-time instance . 110).Added: File import status dialog is now configurable (you can disable it, if you want to). 111).Added: There is a preview area for screenshots, available in reports. 112).Improved: Now Viewer is more Vista-friendly (i.e. file associations are managed in HKCU, rather that in HKLM, storing configuration in user's Application Data, etc, etc). 113).Added: Report's list now supports multi-select, so operations can be performed on many reports at time. 114).Added: There are plenty of new command line abilities, like specifying several files and new switches. 115).Improved: Bunch of minor changes and improvements. WARNING: -------- There are many changes in this release. See the "Changed from the old 6.x version" help topic for further information! EurekaLog 7 also have "EurekaLog 6 backward compatibility mode". Please, refer to help file for more information. We also have the detailed "Upgrade guide" in our help system.
需要先安装Patch1。 Patch 2 for RAD Studio 10.4 now available This patch addresses a number of issues in RAD Studio 10.4, pertaining to Delphi Compiler, the RAD Studio IDE in general and the new LSP-based Code Insight in particular, plus C++ Builder Android exceptions and some debugger issues. The installation of this patch requires a prior installation of Patch #1 (separately available on GetIt and in the download portal). Installing this patch is recommended for all RAD Studio 10.4 customers. Note that this patch is fairly large to download (around 190 MB). The patch includes detailed installation instructions as part of the Readme. Please read the steps carefully (or the corresponding steps in this blog post), as the GetIt download does not install the patch automatically. You must follow the instructions in order to install. Just using GetIt is not enough. List of Customer Reported Issues Addressed in 10.4 Patch 2 RAD Studio 10.4 Patch #2 addresses the following issues reported by customer on Embarcadero Quality Portal (https://quality.embarcadero.com): RSP-29628 VCL Grids bug RSP-29560 [REGRESSION] Misalignment in TStringGrid, StretchDraw method in OnDrawCell RSP-29412 Compiler generates incorrect code for if-then RSP-29402 Delphi 10.4 TStringGrid.OnDrawCell bug RSP-29374 Wrong rect coords in TStringGridDrawCell, so image are drawn at wrong position RSP-29347 [DelphiLSP] IDE Crashes when view form as text is selected and running LSP server RSP-29310 Internal error L891 when linking because of complex types based on records with class var RSP-29299 CODEGEN bug in managed fields initialization, associated with new management operators. RSP-29271 [DelphiLSP] Code Insight adds unneeded () when changing procedures/functions RSP-29256 Compiler generates wrong code for template function RSP-29227 Incorrect property value obtained from the record RSP-29226 Access violation with working code under 10.2 RSP-29218 compiling static library under Android error E4620 processing resource .fmx -2 raised RSP-29172 Access Violation when opening License Manager RSP-29142 GoTo statements not working RSP-29136 Dialog constantly pops up during debugging RSP-29129 iOS App simply crashes with a TWebBrowser on it. RSP-29127 Compiler internal error if you ignore the result of a function that returns a generic record RSP-29124 ICE E1812 RSP-28989 License Manager has access violation error when i click on Workstation Licenses RSP-28887 Space does not finish code completion RSP-28857 Default(T) generates bad code for managed record RSP-28821 [Regression] TStringGrid.OnDrawCell parameter Rect contains wrong values RSP-28808 Project options dialog page "Delphi Compiler" is not populated when opening the dialog RSP-28796 RVO for M-records: initialisation of local variables RSP-28761 [REGRESSION] E2154 Type 'T' needs finalization - not allowed in variant record RSP-28737 Compiler error when inlining new Bit Counting Standard Functions RSP-28735 Managed Records Causing Internal Compiler Error RSP-28717 Delphi Package fails to compile RSP-28701 Bind visually on TDBGRID kills the IDE RSP-28669 [BadCG] Value M-record parameters: improper AddRefRecord RSP-28659 RVO for M-records: assignment to local variables RSP-28616 [BadCG] Operator Assign should not allow non-default calling conventions RSP-28615 [BadCG] In the absence of Initialize, finalisation is not guaranteed for local variables RSP-28552 Poor code generation for local managed record variables RSP-28499 Options - Translation tools - Font - Corrupted? RSP-28476 LSP ErrorInsight in Structure Pane only shows one keystroke after editor RSP-28400 [BadCG] Operator Assign is not always invoked for fields RSP-28372 [Regression] Bad codegen in function returning generic type RSP-27268 C++ Builder 10.3.3 Android Exceptions RSP-27251 Internal error when trying to inline with optimization on RSP-24079 Package version is broken RSP-23403 Build for linux 64 error RSP-23024 Record helper class constructor gives senseless compiler warning RSP-22318 Pointer type check missed when object field is a dynarray RSP-21554 Compiler generates incorrect code for parameterized record type RSP-21248 Const dynamic array unexpectedly contains uninitialized data RSP-20372 A generic "reference to function" will only match the first of several overloaded functions RSP-19714 Win32 compiler - Memory corruption with array helpers RSP-18241 *.c source files, added to C++ project, got added to DeploymentManager file list RSP-18148 AV in TList.Remove (64-bit compiler only)
Contents Contents iii List of Tables xi List of Figures xv 1 General 1 1.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Terms and definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Implementation compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.5 Structure of this International Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.6 Syntax notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.7 The C++ memory model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.8 The C++ object model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.9 Program execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.10 Multi-threaded executions and data races . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.11 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2 Lexical conventions 17 2.1 Separate translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.2 Phases of translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.3 Character sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.4 Trigraph sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.5 Preprocessing tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.6 Alternative tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.7 Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.8 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.9 Header names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.10 Preprocessing numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.11 Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.12 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.13 Operators and punctuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.14 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3 Basic concepts 34 3.1 Declarations and definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.2 One definition rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 3.3 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.4 Name lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.5 Program and linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3.6 Start and termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.7 Storage duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 3.8 Object lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.9 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.10 Lvalues and rvalues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Contents iii ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 3.11 Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4 Standard conversions 81 4.1 Lvalue-to-rvalue conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.2 Array-to-pointer conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.3 Function-to-pointer conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.4 Qualification conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.5 Integral promotions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 4.6 Floating point promotion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.7 Integral conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.8 Floating point conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.9 Floating-integral conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.10 Pointer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.11 Pointer to member conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.12 Boolean conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 4.13 Integer conversion rank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 5 Expressions 87 5.1 Primary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 5.2 Postfix expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5.3 Unary expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 5.4 Explicit type conversion (cast notation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 5.5 Pointer-to-member operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 5.6 Multiplicative operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 5.7 Additive operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 5.8 Shift operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 5.9 Relational operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 5.10 Equality operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 5.11 Bitwise AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.12 Bitwise exclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.13 Bitwise inclusive OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.14 Logical AND operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5.15 Logical OR operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 5.16 Conditional operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 5.17 Assignment and compound assignment operators . . . . . . . . . . . . . . . . . . . . . . . . 125 5.18 Comma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 5.19 Constant expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 6 Statements 130 6.1 Labeled statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 6.2 Expression statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 6.3 Compound statement or block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 6.4 Selection statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 6.5 Iteration statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 6.6 Jump statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 6.7 Declaration statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 6.8 Ambiguity resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 7 Declarations 140 7.1 Specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 7.2 Enumeration declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Contents iv ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 7.3 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 7.4 The asm declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 7.5 Linkage specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 7.6 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 8 Declarators 182 8.1 Type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 8.2 Ambiguity resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 8.3 Meaning of declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 8.4 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 8.5 Initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 9 Classes 216 9.1 Class names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 9.2 Class members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 9.3 Member functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 9.4 Static members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 9.5 Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 9.6 Bit-fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 9.7 Nested class declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 9.8 Local class declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 9.9 Nested type names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 10 Derived classes 233 10.1 Multiple base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 10.2 Member name lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 10.3 Virtual functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 10.4 Abstract classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 11 Member access control 246 11.1 Access specifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 11.2 Accessibility of base classes and base class members . . . . . . . . . . . . . . . . . . . . . . . 249 11.3 Friends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 11.4 Protected member access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 11.5 Access to virtual functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 11.6 Multiple access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 11.7 Nested classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 12 Special member functions 257 12.1 Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 12.2 Temporary objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 12.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 12.4 Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 12.5 Free store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 12.6 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 12.7 Construction and destruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 12.8 Copying and moving class objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 12.9 Inheriting constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 13 Overloading 289 13.1 Overloadable declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Contents v ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 13.2 Declaration matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 13.3 Overload resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 13.4 Address of overloaded function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 13.5 Overloaded operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 13.6 Built-in operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 14 Templates 321 14.1 Template parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 14.2 Names of template specializations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 14.3 Template arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 14.4 Type equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 14.5 Template declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 14.6 Name resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 14.7 Template instantiation and specialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 14.8 Function template specializations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 15 Exception handling 400 15.1 Throwing an exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 15.2 Constructors and destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 15.3 Handling an exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 15.4 Exception specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 15.5 Special functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 16 Preprocessing directives 411 16.1 Conditional inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 16.2 Source file inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 16.3 Macro replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 16.4 Line control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 16.5 Error directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 16.6 Pragma directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 16.7 Null directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 16.8 Predefined macro names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 16.9 Pragma operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 17 Library introduction 424 17.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 17.2 The C standard library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 17.3 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 17.4 Additional definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 17.5 Method of description (Informative) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 17.6 Library-wide requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 18 Language support library 454 18.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 18.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 18.3 Implementation properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 18.4 Integer types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 18.5 Start and termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 18.6 Dynamic memory management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 18.7 Type identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 18.8 Exception handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Contents vi ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 18.9 Initializer lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 18.10 Other runtime support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 19 Diagnostics library 484 19.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 19.2 Exception classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 19.3 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 19.4 Error numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 19.5 System error support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 20 General utilities library 500 20.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 20.2 Utility components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 20.3 Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 20.4 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 20.5 Class template bitset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 20.6 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 20.7 Smart pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 20.8 Function objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 20.9 Metaprogramming and type traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 20.10 Compile-time rational arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602 20.11 Time utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 20.12 Class template scoped_allocator_adaptor . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 20.13 Class type_index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625 21 Strings library 628 21.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 21.2 Character traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 21.3 String classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 21.4 Class template basic_string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 21.5 Numeric conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665 21.6 Hash support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 21.7 Null-terminated sequence utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667 22 Localization library 671 22.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 22.2 Header <locale> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 22.3 Locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 22.4 Standard locale categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684 22.5 Standard code conversion facets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 22.6 C library locales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 23 Containers library 728 23.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 23.2 Container requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 23.3 Sequence containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754 23.4 Associative containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786 23.5 Unordered associative containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803 23.6 Container adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819 24 Iterators library 829 Contents vii ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 24.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 24.2 Iterator requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 24.3 Header <iterator> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834 24.4 Iterator primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 24.5 Iterator adaptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841 24.6 Stream iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855 25 Algorithms library 863 25.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863 25.2 Non-modifying sequence operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873 25.3 Mutating sequence operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878 25.4 Sorting and related operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887 25.5 C library algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900 26 Numerics library 902 26.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 26.2 Numeric type requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 26.3 The floating-point environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 903 26.4 Complex numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904 26.5 Random number generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 914 26.6 Numeric arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959 26.7 Generalized numeric operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 981 26.8 C library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 984 27 Input/output library 989 27.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989 27.2 Iostreams requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 27.3 Forward declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 990 27.4 Standard iostream objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 992 27.5 Iostreams base classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994 27.6 Stream buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1013 27.7 Formatting and manipulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1023 27.8 String-based streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049 27.9 File-based streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1061 28 Regular expressions library 1076 28.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076 28.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076 28.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077 28.4 Header <regex> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079 28.5 Namespace std::regex_constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1086 28.6 Class regex_error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089 28.7 Class template regex_traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089 28.8 Class template basic_regex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1092 28.9 Class template sub_match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097 28.10 Class template match_results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1103 28.11 Regular expression algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1108 28.12 Regular expression iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1113 28.13 Modified ECMAScript regular expression grammar . . . . . . . . . . . . . . . . . . . . . . . 1119 29 Atomic operations library 1122 Contents viii ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 29.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1122 29.2 Header <atomic> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1122 29.3 Order and consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1125 29.4 Lock-free property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1128 29.5 Atomic types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1128 29.6 Operations on atomic types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1132 29.7 Flag type and operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1137 29.8 Fences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1138 30 Thread support library 1140 30.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140 30.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140 30.3 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1143 30.4 Mutual exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149 30.5 Condition variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162 30.6 Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1170 A Grammar summary 1187 A.1 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1187 A.2 Lexical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1187 A.3 Basic concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1192 A.4 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1192 A.5 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195 A.6 Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1196 A.7 Declarators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1200 A.8 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1202 A.9 Derived classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1203 A.10 Special member functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1203 A.11 Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1204 A.12 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1204 A.13 Exception handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1205 A.14 Preprocessing directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1205 B Implementation quantities 1207 C Compatibility 1209 C.1 C++ and ISO C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1209 C.2 C++ and ISO C++ 2003 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1218 C.3 C standard library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1225 D Compatibility features 1229 D.1 Increment operator with bool operand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 D.2 register keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 D.3 Implicit declaration of copy functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 D.4 Dynamic exception specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 D.5 C standard library headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 D.6 Old iostreams members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1230 D.7 char* streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1231 D.8 Function objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1240 D.9 Binders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1243 D.10 auto_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1245 Contents ix ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved D.11 Violating exception-specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1247 E Universal character names for identifier characters 1249 E.1 Ranges of characters allowed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1249 E.2 Ranges of characters disallowed initially . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1249 F Cross references 1250 Index 1268 Index of grammar productions 1297 Index of library names 1300 Index of implementation-defined behavior 1336 Contents x ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved List of Tables 1 Trigraph sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2 Alternative tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3 Identifiers with special meaning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5 Alternative representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 6 Types of integer constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 7 Escape sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 8 String literal concatenations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 9 Relations on const and volatile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 10 simple-type-specifiers and the types they specify . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 11 Relationship between operator and function call notation . . . . . . . . . . . . . . . . . . . . . . 297 12 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 13 Library categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 14 C++ library headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 15 C++ headers for C library facilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 16 C++ headers for freestanding implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 17 EqualityComparable requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 18 LessThanComparable requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 19 DefaultConstructible requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 20 MoveConstructible requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 21 CopyConstructible requirements (in addition to MoveConstructible) . . . . . . . . . . . . . . . 438 22 MoveAssignable requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 23 CopyAssignable requirements(in addition to MoveAssignable) . . . . . . . . . . . . . . . . . . . 438 24 Destructible requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 25 NullablePointer requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 26 Hash requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 27 Descriptive variable definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 28 Allocator requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 29 Language support library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 30 Header <cstddef> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 31 Header <climits> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 32 Header <cfloat> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 33 Header <cstdlib> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 34 Header <csetjmp> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 35 Header <csignal> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 36 Header <cstdalign> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 37 Header <cstdarg> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 38 Header <cstdbool> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 39 Header <cstdlib> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 40 Header <ctime> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 List of Tables xi ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 41 Diagnostics library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 42 Header <cassert> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 43 Header <cerrno> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 44 General utilities library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 45 Header <cstdlib> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 46 Header <cstring> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 47 Primary type category predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 48 Composite type category predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 49 Type property predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 50 Type property queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 51 Type relationship predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596 52 Const-volatile modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 53 Reference modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598 54 Sign modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598 55 Array modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 56 Pointer modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 57 Other transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 58 Expressions used to perform ratio arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 59 Clock requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 60 Header <ctime> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 61 Strings library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 62 Character traits requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 63 basic_string(const Allocator&) effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643 64 basic_string(const basic_string&) effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643 65 basic_string(const basic_string&, size_type, size_type, const Allocator&) effects . 643 66 basic_string(const charT*, size_type, const Allocator&) effects . . . . . . . . . . . . . . 644 67 basic_string(const charT*, const Allocator&) effects . . . . . . . . . . . . . . . . . . . . . 644 68 basic_string(size_t, charT, const Allocator&) effects . . . . . . . . . . . . . . . . . . . . 644 69 basic_string(const basic_string&, const Allocator&) and basic_string(basic_string&&, const Allocator&) effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645 70 operator=(const basic_string<charT, traits, Allocator>&) effects . . . . . . . . . . . . . 645 71 operator=(const basic_string<charT, traits, Allocator>&&) effects . . . . . . . . . . . . 645 72 compare() results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659 73 Potential mbstate_t data races . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 74 Header <cctype> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 75 Header <cwctype> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 76 Header <cstring> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 77 Header <cwchar> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 78 Header <cstdlib> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669 79 Header <cuchar> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670 80 Localization library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 81 Locale category facets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675 82 Required specializations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 83 do_in/do_out result values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 84 do_unshift result values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 85 Integer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 86 Length modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 87 Integer conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 List of Tables xii ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 88 Floating-point conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 89 Length modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 90 Numeric conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 91 Fill padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 92 do_get_date effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 93 Header <clocale> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 94 Potential setlocale data races . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 95 Containers library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 96 Container requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 97 Reversible container requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 98 Optional container operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 99 Allocator-aware container requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 100 Sequence container requirements (in addition to container) . . . . . . . . . . . . . . . . . . . . . 735 101 Optional sequence container operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 102 Associative container requirements (in addition to container) . . . . . . . . . . . . . . . . . . . . 740 103 Unordered associative container requirements (in addition to container) . . . . . . . . . . . . . . 746 104 Iterators library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 105 Relations among iterator categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829 106 Iterator requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831 107 Input iterator requirements (in addition to Iterator) . . . . . . . . . . . . . . . . . . . . . . . . . 831 108 Output iterator requirements (in addition to Iterator) . . . . . . . . . . . . . . . . . . . . . . . . 832 109 Forward iterator requirements (in addition to input iterator) . . . . . . . . . . . . . . . . . . . . 833 110 Bidirectional iterator requirements (in addition to forward iterator) . . . . . . . . . . . . . . . . . 833 111 Random access iterator requirements (in addition to bidirectional iterator) . . . . . . . . . . . . 834 112 Algorithms library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863 113 Header <cstdlib> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900 114 Numerics library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 902 115 Seed sequence requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915 116 Uniform random number generator requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 916 117 Random number engine requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917 118 Random number distribution requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921 119 Header <cmath> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 984 120 Header <cstdlib> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985 121 Input/output library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989 122 fmtflags effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999 123 fmtflags constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999 124 iostate effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999 125 openmode effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1000 126 seekdir effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1000 127 Position type requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004 128 basic_ios::init() effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1007 129 basic_ios::copyfmt() effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008 130 seekoff positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1054 131 newoff values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1054 132 File open modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064 133 seekoff effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067 List of Tables xiii ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved 134 Header <cstdio> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1074 135 Header <cinttypes> synopsis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075 136 Regular expressions library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076 137 Regular expression traits class requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077 138 syntax_option_type effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087 139 regex_constants::match_flag_type effects when obtaining a match against a character container sequence [first,last). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087 140 error_type values in the C locale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1088 141 match_results assignment operator effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1105 142 Effects of regex_match algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109 143 Effects of regex_search algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1110 144 Atomics library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1122 145 atomic integral typedefs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131 146 atomic <inttypes.h> typedefs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1132 147 Atomic arithmetic computations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1136 148 Thread support library summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1140 149 Standard macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1225 150 Standard values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1225 151 Standard types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1226 152 Standard structs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1226 153 Standard functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1226 154 C headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1229 155 strstreambuf(streamsize) effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1233 156 strstreambuf(void* (*)(size_t), void (*)(void*)) effects . . . . . . . . . . . . . . . . . . 1233 157 strstreambuf(charT*, streamsize, charT*) effects . . . . . . . . . . . . . . . . . . . . . . . . 1234 158 seekoff positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1236 159 newoff values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1236 List of Tables xiv ISO/IEC 14882:2011(E) © ISO/IEC 2011 – All rights reserved List of Figures 1 Expression category taxonomy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 2 Directed acyclic graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 3 Non-virtual base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 4 Virtual base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 5 Virtual and non-virtual base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 6 Name lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 7 Stream position, offset, and size types [non-normative] . . . . . . . . . . . . . . . . . . . . . . . . 989 List of

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

草上爬

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值