2011년 4월 17일 일요일

cpp] visual C++ 2010 start.

What's New in Visual C++ 2010
뭣이 달라졌나? 간단하게 달라진 항목들만 보자.

Visual Studio 2010
This document introduces new and enhanced Visual C++ features in Visual Studio 2010.
Visual C++ Compiler and Linker

auto 로 변수 선언하던게 뭔가 바뀌었나 보다.

auto Keyword

The auto keyword has a new purpose. Use the default meaning of the auto keyword to declare a variable whose type is deduced from the initialization expression in the declaration of the variable. The /Zc:auto compiler option invokes either the new or the previous meaning of the auto keyword.

decltype 이란게 있는 줄도 몰랐는데...
template<typename T, typename U>
auto myFunc(T&& t, U&& u) -> decltype (forward<T>(t) + forward<U>(u))
        { return forward<T>(t) + forward<U>(u); };

decltype Type Specifier

The decltype type specifier returns the type of a specified expression. Use the decltype type specifier in combination with the auto keyword to declare a type that is either complex or known only to the compiler. For example, use the combination to declare a template function whose return type depends on the types of its template arguments. Or, declare a template function that calls another function, and then returns the return type of the called function.

람다 먹는거임?

Lambda Expressions

Lambda functions have a function body but no name. Lambda functions combine the best characteristics of function pointers and function objects.
Use a lambda function by itself, as a template function parameter instead of a function object, or together with the auto keyword to declare a variable whose type is a lambda.

템플릿을 배워야겠군... &&가 뭐가 달라졌단 거여?

template <typename T> void print_type_and_value(T&& t)
{
   S<T&&>::print(std::forward<T>(t));
}

Rvalue Reference

The rvalue reference declarator (&&) declares a reference to an rvalue. An rvalue reference lets you use move semantics and perfect forwarding to write more efficient constructors, functions, and templates.

오 static전체에 assert를 걸 수 있나?

static_assert Declaration

A static_assert declaration tests a software assertion at compile time, unlike other assertion mechanisms that test at run time. If the assertion fails, the compilation fails and a specified error message is issued.

걍 널이 아니라 nullptr이 생겼군!

nullptr and __nullptr Keywords

The Visual C++ compiler lets you use the nullptr keyword with native code or with managed code. The nullptr keyword indicates that an object handle, interior pointer, or native pointer type does not point to an object. The compiler interprets nullptr to be managed code when you use the /clr compiler option, and native code when you do not use the /clr option.
The Microsoft-specific __nullptr keyword has the same meaning as nullptr, but it applies to native code only. If you compile native C/C++ code by using the /clr compiler option, the compiler cannot determine whether the nullptr keyword is a native or a managed term. To make your intention clear to the compiler, use the nullptr keyword to specify the managed term, and __nullptr to specify the native term.

오호 먼 옵션을 추가로 쓸수도 있구먼.. 그래프 그려주는 건가?

/Zc:trigraphs Compiler Option

By default, support for trigraphs is disabled. Use the /Zc:trigraphs compiler option to enable trigraphs support.
A trigraph consists of two consecutive question marks (??) followed by a unique third character. The compiler replaces a trigraph with the corresponding punctuation character. For example, the compiler replaces the ??= trigraph with the # (number sign) character. Use trigraphs in C source files that use a character set that does not contain certain punctuation characters.

헐.. 너무 많다. 나중에 책 나오면 편하게 봐야겠네.

그래도 새로운 기능을 한번 봤다는 것은 중요하다.

댓글 없음:

댓글 쓰기

국정원의 댓글 공작을 지탄합니다.

UPBIT is a South Korean company, and people died of suicide cause of coin investment.

 UPBIT is a South Korean company, and people died of suicide cause of coin. The company helps the people who control the market price manipu...