c++11特性
1767 ワード
#include
long double operator"" _mm(long double x) { return x / 1000; }
long double operator"" _m(long double x) { return x; }
long double operator"" _km(long double x) { return x * 1000; }
int main()
{
std::cout << 1.0_mm << '
';
std::cout << 1.0_m << '
';
std::cout << 1.0_km << '
';
}
MyString(MyString && str){
std::cout<
#include
using namespace std;
template
void f(T ... args){
cout<
Parameter pack
A constexpr variable must satisfy the following requirements: its type must be a LiteralType . it must be immediately initialized the full-expression of its initialization, including all implicit conversions, constructors calls, etc, must be a constant expression
A constexpr function must satisfy the following requirements: it must not be virtual its return type must be LiteralType each of its parameters must be LiteralType there exists at least one set of argument values such that an invocation of the function could be an evaluated subexpression of a core constant expression (for constructors, use in a constant initializer is sufficient) (since C++14). No diagnostic is required for a violation of this bullet.