C ++ 11の新機能の概要

C++版本测试
#include <iostream>
using namespace std;

int main()
{
	cout << __cplusplus << endl;

	system("pause");
	return 0;
}
常见的新增头文件
#include <type_traits>
#include <unordered_set>
#include <forward_list>
#include <array>
#include <tuple>
#include <regex>
#include <thread>
#include <chrono>

语言重要新特性:
Variadic Templates
Move Semantics
auto
Range-base for loop
Initializer list
Lambdas

标准库重要新特性:
type_traits
Unordered容器
forward_list
array
tuple
Con-currency
Regex


Variadic Template 可以很方便的实现递归   注意需要一个递归基
#include <iostream>
#include <bitset>
using namespace std;

void print() {}

template < typename... Types>
void print(const Types& ... args)
{
	cout<<"LINE = "<<__LINE__<<", left args: "<<sizeof...(args)<<endl;
	print(args...);
}


template <typename T, typename... Types>
void print(const T& firstArg, const Types& ...args) {
	cout<<"LINE = "<<__LINE__<<", left args: "<<sizeof...(args)<<endl;
	cout<<firstArg<<endl;
	print(args...);
}

int main()
{
	print(5.0,"hello,world.",bitset<32>(16),12);
	return 0;
}

おすすめ

転載: www.cnblogs.com/bitsstitcher/p/11532435.html