불어오는 변화의 바람, From c++98 to c++11, 14

명신 김
명신 김Principal Technical Evangelist um Microsoft Korea
불어오는 변화의 바람
C++98 to C++11/14
김명신 부장 / Microsoft
옥찬호 대표 / C++ Korea
WHY C++ WHY NOT
Programming Language 2014 2009 2004 1999 1994 1989
C 1 2 2 1 1 1
Java 2 1 1 3 - -
Objective-C 3 26 36 - - -
C++ 4 3 3 2 2 2
C# 5 5 8 17 - -
PHP 6 4 5 32 - -
Python 7 6 6 22 22 -
JavaScript 8 8 9 9 - -
Visual Basic. NET 9 - - - - -
Perl 10 7 4 4 10 21
Pascal 15 13 80 7 3 23
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Gaming, 20%
Engr/Science,
15%
Frameworks,
12%
Business,
10%Embedded,
8%
Productivity,
8%
Imaging, 7%
Content, 7%
Other, 13%
Source: Microsoft
Bjarne Stroustrup
Known as D&E
Leave no room for
lower-level language
below c++
What you don’t use you
don’t pay for
(zero-overhead principle)
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
King of the Performance / $
불어오는 변화의 바람, From c++98 to c++11, 14
http://perspectives.mvdirona.com/2010/09/18/OverallDataCenterCosts.aspx
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
윈도우용 출시
윈도우
안드로이드
iOS
OS X
This is new World!
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람, From c++98 to c++11, 14
불어오는 변화의 바람
C++98 to C++11/14
옥찬호 대표 / C++ Korea
목차
1. C++ Korea 소개
2. C++11/14 New Features
3. C++17 Features Preview
4. Related C++ Libraries
C++ Korea 소개
C++ Korea
• https://www.facebook.com/groups/cppkorea/
• 2013년 11월 개설
• 2014년 마이크로소프트 커뮤니티
멜팅팟 프로그램 2기 선정
• 2014년 10월 1기 운영진 선발
• 2014년 12월 멜팅팟 세미나 개최
• Effective Modern C++ 스터디 예정
• 자세한 사항은 그룹 공지사항 참조
페이스북 이벤트
• https://www.facebook.com/groups/cppkorea/
• C++ Korea 그룹에 가입하시고,
현장 사진을 올려주세요!
• 세션 종료 후 추첨을 통해
2분을 선정하여 C++ 관련 서적을
드립니다.
• 추첨 방법 : srand(NULL);
ISO C++ Committee
• http://isocpp.org/std/the-committee
• ISO C++ 표준을 승인하는 기구
• 정기적으로 모여 새로운 C++ 표준에
추가하거나 변경, 삭제될 기능을 논의
• 여러 그룹으로 구성되어 있음
VC++ Conformance Update
C++11/14 New Features
Overview
vector<vector<int>>
user-defined
literals thread_local
=default, =delete
atomic<T> auto f() -> int
array<T, N>
decltype
vector<LocalType> noexcept
regex
initializer lists
constexpr
extern template
C++
unordered_map<int, string>raw string literals
nullptr auto i = v.begin();
async
lambdas
[]{ foo(); }
template
aliases
unique_ptr<T>
shared_ptr<T>
weak_ptr<T>
thread, mutex
for (x : coll)
override,
final
variadic templates
template <typename T…>
function<> future<T>
tuple<int, float, string>
strongly-typed enums
enum class E {…};
static_assert(x)
rvalue references
(move semantics)
delegating constructors
Overview
vector<vector<int>>
user-defined
literals thread_local
=default, =delete
atomic<T> auto f() -> int
array<T, N>
decltype
vector<LocalType> noexcept
regex
initializer lists
constexpr
extern template
C++
unordered_map<int, string>raw string literals
nullptr auto i = v.begin();
async
lambdas
[]{ foo(); }
template
aliases
unique_ptr<T>
shared_ptr<T>
weak_ptr<T>
thread, mutex
for (x : coll)
override,
final
variadic templates
template <typename T…>
function<> future<T>
tuple<int, float, string>
strongly-typed enums
enum class E {…};
static_assert(x)
rvalue references
(move semantics)
delegating constructors
Overview
vector<vector<int>>
user-defined
literals thread_local
=default, =delete
atomic<T> auto f() -> int
array<T, N>
decltype
vector<LocalType> noexcept
regex
initializer lists
constexpr
extern template
C++
unordered_map<int, string>raw string literals
nullptr auto i = v.begin();
async
lambdas
[]{ foo(); }
template
aliases
unique_ptr<T>
shared_ptr<T>
weak_ptr<T>
thread, mutex
for (x : coll)
override,
final
variadic templates
template <typename T…>
function<> future<T>
tuple<int, float, string>
strongly-typed enums
enum class E {…};
static_assert(x)
rvalue references
(move semantics)
delegating constructors
auto
map<string, string>::const_iterator it = m.cbegin();
double const param = config["param"];
singleton& s = singleton::instance();
auto it = m.begin();
auto const param = config["param"];
auto& s = singleton::instance();
컴파일 타임 추론
decltype
template<class T, class U>
??? add(T x, U y)
{
return x + y;
}
템플릿 함수의 반환형은 컴파일 타임 때 알고 있어야 함
decltype
template<class T, class U>
decltype(x+y) add(T x, U y)
{
return x + y;
}
decltype을 사용하면 컴파일 타임 때 반환형을 추론
nullptr
foo(NULL);
#define NULL 0
void foo(char*);
void foo(int);
foo(nullptr);
Strongly-typed Enums
enum class Alert { green, yellow, red };
int lightColor = red; // 오류
Alert lightColor = Alert::red;
int convertColor = static_cast<int>(Alert::red);
enum Alert { green, yellow, red };
int lightColor = red;
enum → int
Conversion
Uniform Initialization
vector<int> v;
v.push_back(10);
v.push_back(20);
map<int, string> labels;
labels.insert(make_pair(1, “Open”));
labels.insert(make_pair(2, “Close”));
데이터를 컨테이너에 각각 추가
추가하는 방법도 다름
Uniform Initialization
vector<int> v = {10, 20};
map<int, string> labels {
{1, “Open”}, {2, “Close”}
};
데이터를 컨테이너에 일괄 추가
추가하는 방법도 같음
initializer_list<int>
initializer_list<pair<int, string>>
std::initializer_list
template<class T>
struct S {
vector<T> v;
S(initializer_list<T> l) : v(l) { }
void append(initializer_list<T> l) {
v.insert(v.end(), l.begin(), l.end());
}
};
S<int> s = {1, 2, 3, 4, 5};
s.append({6, 7, 8});
S<char> t = {‘a’, ‘b’};
s.append({‘c’, ‘d’, ‘e’, ‘f’});
Variadic Template
template<class T>
void print_list(T value)
{
cout << value << endl;
}
template<class First, class …Rest>
void print_list(First first, Rest …rest) {
cout << first <<“, “;
print_list(rest…);
}
Variadic Template
print_list(42, “hello”, 2.3, ‘a’);
print_list(first = 42, …rest = “hello”, 2.3, ‘a’)
42
print_list(first = “hello”, …rest = 2.3, ‘a’)
hello
print_list(first = 2.3, …rest = ‘a’)
2.3
print_list(value = ‘a’)
a
42, hello, 2.3, a
template<class T>
void print_list(T value) { … }
재귀 함수를 끝내기 위한
별도의 함수 필요
Delegating Constructors
class A {
int a;
void validate(int x) {
if (x > 0 && x <= 42) a = x;
}
public:
A(int x) { validate(x); }
A() { validate(42); }
A(string s) { int x = stoi(s); validate(x); }
};
생성자를 각각 구현하고, 별도의 함수 호출
Delegating Constructors
class A {
int a;
public:
A(int x) {
if (x > 0 && x <= 42) a = x;
}
A() : A(42) { }
A(string s) : A(stoi(s)) { }
};
1개의 생성자를 구현한 뒤, 위임 호출
C++17 Features Preview
C++17 Features Preview
• Extended constants evaluation
• Folding expressions
• uncaught_exceptions
• Forwarding references
• u8 character literals
• Nested namespace definitions
• auto x{y};
• auto_ptr, bind1st/bind2nd, ptr_fun/mem_fun/mem_fun_ref,
random_shuffle all removed
Folding Expressions
template <typename… Args>
bool all(Args… args) {
return (args && …);
}
bool b = all(true, true, true, false);
bool b2 = all();
((true && true) && true) && false
Folding Expressions
template <typename… Args>
bool all(Args… args) {
return (args && …);
}
bool b = all(true, true, true, false);
bool b2 = all();
true
Related C++ Libraries
Boost
• http://www.boost.org
• C++ 위원회 멤버들로부터 시작된 오픈 소스 라이브러리
• C++ 표준 라이브러리가 업데이트 될 때
Boost 라이브러리에 있는 많은 기능들이 채택됨
• Boost.Asio, Boost.Log, Boost.ScopeExit 등
• References
• boost.org 문서
• Boost.Asio를 이용한 네트워크 프로그래밍
(한빛미디어, 2013)
Case Studies : CGSF
• https://github.com/pdpdds/CGSF
• 캐주얼 게임을 위해 제작된 서버 라이브러리
• Boost.Asio를 커스터마이징해 네트워크 엔진으로 사용
Qt
• http://qt-project.org
• GUI 프로그램 개발에 널리 쓰이는 크로스 플랫폼 프레임워크
• C++을 주로 사용하지만, Python, Ruby, C, Perl, Pascal과도 연동
• SQL DB 접근, XML 처리, Thread 관리, 파일 관리 API 제공
• References
• qt-project.org 문서
• QT5 프로그래밍 가이드(성안당, 2014)
• QT4를 이용한 C++ GUI 프로그래밍
(아이티씨, 2009)
Case Studies
• MuseScore – 작곡 프로그램
• Pada Software – 워드프로세서
• Tiled – 2D 타일 맵 에디터
C++ AMP(Accelerated Massive Parallelism)
• http://msdn.microsoft.com/ko-kr/library/hh265136.aspx
• VS C++에서 GPGPU 프로그래밍 환경을 제공
• 또 다른 컴파일러나 다른 구문을 배울 필요가 없음
• C++ AMP는 DirectX의 DirectCompute 사용,
Microsoft Vista 이상에서만 사용 가능 (DirectX10에서 지원)
• References
• MSDN 문서
• C++ AMP : Visual C++와 GPGPU를 이용한
대규모 병렬 프로그래밍 (한빛미디어, 2013)
C++ AMP Demo
불어오는 변화의 바람, From c++98 to c++11, 14
1 von 54

Recomendados

[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기 von
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기
[TechDays Korea 2015] 녹슨 C++ 코드에 모던 C++로 기름칠하기Chris Ohk
6.8K views79 Folien
C++ 11 에 대해서 쉽게 알아봅시다 1부 von
C++ 11 에 대해서 쉽게 알아봅시다 1부C++ 11 에 대해서 쉽게 알아봅시다 1부
C++ 11 에 대해서 쉽게 알아봅시다 1부Gwangwhi Mah
3.9K views38 Folien
C++17 Key Features Summary - Ver 2 von
C++17 Key Features Summary - Ver 2C++17 Key Features Summary - Ver 2
C++17 Key Features Summary - Ver 2Chris Ohk
17.6K views83 Folien
[C++ Korea 2nd Seminar] C++17 Key Features Summary von
[C++ Korea 2nd Seminar] C++17 Key Features Summary[C++ Korea 2nd Seminar] C++17 Key Features Summary
[C++ Korea 2nd Seminar] C++17 Key Features SummaryChris Ohk
10.5K views79 Folien
Nexon Developers Conference 2017 Functional Programming for better code - Mod... von
Nexon Developers Conference 2017 Functional Programming for better code - Mod...Nexon Developers Conference 2017 Functional Programming for better code - Mod...
Nexon Developers Conference 2017 Functional Programming for better code - Mod...Isaac Jeon
3.9K views61 Folien
C++11 von
C++11C++11
C++11선협 이
4.8K views61 Folien

Más contenido relacionado

Was ist angesagt?

[KGC 2011]Boost 라이브러리와 C++11 von
[KGC 2011]Boost 라이브러리와 C++11[KGC 2011]Boost 라이브러리와 C++11
[KGC 2011]Boost 라이브러리와 C++11흥배 최
11.1K views64 Folien
Boost 라이브리와 C++11 von
Boost 라이브리와 C++11Boost 라이브리와 C++11
Boost 라이브리와 C++11OnGameServer
56.7K views61 Folien
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type... von
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...Seok-joon Yun
3.2K views19 Folien
프로그래밍 대회: C++11 이야기 von
프로그래밍 대회: C++11 이야기프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기Jongwook Choi
46.5K views62 Folien
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne... von
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...Seok-joon Yun
3.1K views28 Folien
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기 von
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기Chris Ohk
11.8K views71 Folien

Was ist angesagt?(20)

[KGC 2011]Boost 라이브러리와 C++11 von 흥배 최
[KGC 2011]Boost 라이브러리와 C++11[KGC 2011]Boost 라이브러리와 C++11
[KGC 2011]Boost 라이브러리와 C++11
흥배 최11.1K views
Boost 라이브리와 C++11 von OnGameServer
Boost 라이브리와 C++11Boost 라이브리와 C++11
Boost 라이브리와 C++11
OnGameServer56.7K views
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type... von Seok-joon Yun
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
Seok-joon Yun3.2K views
프로그래밍 대회: C++11 이야기 von Jongwook Choi
프로그래밍 대회: C++11 이야기프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기
Jongwook Choi46.5K views
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne... von Seok-joon Yun
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...
[C++ korea] Effective Modern C++ study item 19 use shared ptr for shared owne...
Seok-joon Yun3.1K views
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기 von Chris Ohk
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기
[C++ Korea 3rd Seminar] 새 C++은 새 Visual Studio에, 좌충우돌 마이그레이션 이야기
Chris Ohk11.8K views
2013 C++ Study For Students #1 von Chris Ohk
2013 C++ Study For Students #12013 C++ Study For Students #1
2013 C++ Study For Students #1
Chris Ohk4.5K views
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준 von Seok-joon Yun
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
Seok-joon Yun2.4K views
[C++ Korea] Effective Modern C++ Study item14 16 +신촌 von Seok-joon Yun
[C++ Korea] Effective Modern C++ Study item14 16 +신촌[C++ Korea] Effective Modern C++ Study item14 16 +신촌
[C++ Korea] Effective Modern C++ Study item14 16 +신촌
Seok-joon Yun2.8K views
C++20 Key Features Summary von Chris Ohk
C++20 Key Features SummaryC++20 Key Features Summary
C++20 Key Features Summary
Chris Ohk9.9K views
Modern C++ 프로그래머를 위한 CPP11/14 핵심 von 흥배 최
Modern C++ 프로그래머를 위한 CPP11/14 핵심Modern C++ 프로그래머를 위한 CPP11/14 핵심
Modern C++ 프로그래머를 위한 CPP11/14 핵심
흥배 최46.7K views
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w... von Seok-joon Yun
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
[C++ korea] effective modern c++ study item 7 distinguish between () and {} w...
Seok-joon Yun2.2K views
[C++ korea] effective modern c++ study item8~10 정은식 von 은식 정
[C++ korea] effective modern c++ study item8~10 정은식[C++ korea] effective modern c++ study item8~10 정은식
[C++ korea] effective modern c++ study item8~10 정은식
은식 정2.6K views
[C++ Korea] Effective Modern C++ Study, Item 1 - 3 von Chris Ohk
[C++ Korea] Effective Modern C++ Study, Item 1 - 3[C++ Korea] Effective Modern C++ Study, Item 1 - 3
[C++ Korea] Effective Modern C++ Study, Item 1 - 3
Chris Ohk3K views
포트폴리오에서 사용한 모던 C++ von KWANGIL KIM
포트폴리오에서 사용한 모던 C++포트폴리오에서 사용한 모던 C++
포트폴리오에서 사용한 모던 C++
KWANGIL KIM673 views
[C++ korea] effective modern c++ study item 14 declare functions noexcept if ... von Seok-joon Yun
[C++ korea] effective modern c++ study item 14 declare functions noexcept if ...[C++ korea] effective modern c++ study item 14 declare functions noexcept if ...
[C++ korea] effective modern c++ study item 14 declare functions noexcept if ...
Seok-joon Yun3K views
RNC C++ lecture_4 While, For von itlockit
RNC C++ lecture_4 While, ForRNC C++ lecture_4 While, For
RNC C++ lecture_4 While, For
itlockit45 views
C++ Concurrency in Action 9-2 Interrupting threads von Seok-joon Yun
C++ Concurrency in Action 9-2 Interrupting threadsC++ Concurrency in Action 9-2 Interrupting threads
C++ Concurrency in Action 9-2 Interrupting threads
Seok-joon Yun1.1K views

Similar a 불어오는 변화의 바람, From c++98 to c++11, 14

[NDC2016] TERA 서버의 Modern C++ 활용기 von
[NDC2016] TERA 서버의 Modern C++ 활용기[NDC2016] TERA 서버의 Modern C++ 활용기
[NDC2016] TERA 서버의 Modern C++ 활용기Sang Heon Lee
6.8K views64 Folien
About Visual C++ 10 von
About  Visual C++ 10About  Visual C++ 10
About Visual C++ 10흥배 최
1.5K views92 Folien
20150212 c++11 features used in crow von
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crowJaeseung Ha
5.9K views129 Folien
Visual studio 2010 von
Visual studio 2010Visual studio 2010
Visual studio 2010MinGeun Park
872 views32 Folien
Changes in c++0x von
Changes in c++0xChanges in c++0x
Changes in c++0xSang Yeon Jeon
682 views18 Folien
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library von
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard LibraryDongMin Choi
2.4K views82 Folien

Similar a 불어오는 변화의 바람, From c++98 to c++11, 14 (20)

[NDC2016] TERA 서버의 Modern C++ 활용기 von Sang Heon Lee
[NDC2016] TERA 서버의 Modern C++ 활용기[NDC2016] TERA 서버의 Modern C++ 활용기
[NDC2016] TERA 서버의 Modern C++ 활용기
Sang Heon Lee6.8K views
About Visual C++ 10 von 흥배 최
About  Visual C++ 10About  Visual C++ 10
About Visual C++ 10
흥배 최1.5K views
20150212 c++11 features used in crow von Jaeseung Ha
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crow
Jaeseung Ha5.9K views
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library von DongMin Choi
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
[C++ Korea 2nd Seminar] Ranges for The Cpp Standard Library
DongMin Choi2.4K views
Boost라이브러리의내부구조 20151111 서진택 von JinTaek Seo
Boost라이브러리의내부구조 20151111 서진택Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택
JinTaek Seo860 views
//BUILD/ Seoul - .NET의 현재와 미래. 그 새로운 시작 von Taeyoung Kim
//BUILD/ Seoul - .NET의 현재와 미래. 그 새로운 시작//BUILD/ Seoul - .NET의 현재와 미래. 그 새로운 시작
//BUILD/ Seoul - .NET의 현재와 미래. 그 새로운 시작
Taeyoung Kim612 views
Modern C++의 타입 추론과 람다, 컨셉 von HyunJoon Park
Modern C++의 타입 추론과 람다, 컨셉Modern C++의 타입 추론과 람다, 컨셉
Modern C++의 타입 추론과 람다, 컨셉
HyunJoon Park205 views
[Td 2015]녹슨 c++ 코드에 모던 c++로 기름칠하기(옥찬호) von Sang Don Kim
[Td 2015]녹슨 c++ 코드에 모던 c++로 기름칠하기(옥찬호)[Td 2015]녹슨 c++ 코드에 모던 c++로 기름칠하기(옥찬호)
[Td 2015]녹슨 c++ 코드에 모던 c++로 기름칠하기(옥찬호)
Sang Don Kim2.7K views
[Td 2015]windows, linux, mac 신경 안 쓴다. .net 2015와 더더 좋아지는 c# 살짝 훔쳐보기(김명신) von Sang Don Kim
[Td 2015]windows, linux, mac 신경 안 쓴다. .net 2015와 더더 좋아지는 c# 살짝 훔쳐보기(김명신)[Td 2015]windows, linux, mac 신경 안 쓴다. .net 2015와 더더 좋아지는 c# 살짝 훔쳐보기(김명신)
[Td 2015]windows, linux, mac 신경 안 쓴다. .net 2015와 더더 좋아지는 c# 살짝 훔쳐보기(김명신)
Sang Don Kim3.8K views
사례를 통해 살펴보는 프로파일링과 최적화 NDC2013 von Esun Kim
사례를 통해 살펴보는 프로파일링과 최적화 NDC2013사례를 통해 살펴보는 프로파일링과 최적화 NDC2013
사례를 통해 살펴보는 프로파일링과 최적화 NDC2013
Esun Kim7K views
Javascript개발자의 눈으로 python 들여다보기 von 지수 윤
Javascript개발자의 눈으로 python 들여다보기Javascript개발자의 눈으로 python 들여다보기
Javascript개발자의 눈으로 python 들여다보기
지수 윤6.6K views
[Td 2015]java script에게 형(type)이 생겼어요. typescript(박용준) von Sang Don Kim
[Td 2015]java script에게 형(type)이 생겼어요. typescript(박용준)[Td 2015]java script에게 형(type)이 생겼어요. typescript(박용준)
[Td 2015]java script에게 형(type)이 생겼어요. typescript(박용준)
Sang Don Kim486 views
Tech Update - The Future of .NET Framework (김명신 부장) von Eunbee Song
Tech Update - The Future of .NET Framework (김명신 부장)Tech Update - The Future of .NET Framework (김명신 부장)
Tech Update - The Future of .NET Framework (김명신 부장)
Eunbee Song1.9K views
공유 Jdk 7-2-project coin von knight1128
공유 Jdk 7-2-project coin공유 Jdk 7-2-project coin
공유 Jdk 7-2-project coin
knight11281.2K views
Ai C#세미나 von Astin Choi
Ai C#세미나Ai C#세미나
Ai C#세미나
Astin Choi1.7K views
나에 첫번째 자바8 람다식 지앤선 von daewon jeong
나에 첫번째 자바8 람다식   지앤선나에 첫번째 자바8 람다식   지앤선
나에 첫번째 자바8 람다식 지앤선
daewon jeong2.7K views

Más de 명신 김

업무를 빼고 가치를 더하는 클라우드 기술 von
업무를 빼고 가치를 더하는 클라우드 기술업무를 빼고 가치를 더하는 클라우드 기술
업무를 빼고 가치를 더하는 클라우드 기술명신 김
389 views31 Folien
[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기 von
[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기
[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기명신 김
328 views42 Folien
Best of Build Seoul 2019 Keynote von
Best of Build Seoul 2019 KeynoteBest of Build Seoul 2019 Keynote
Best of Build Seoul 2019 Keynote명신 김
455 views105 Folien
Passwordless society von
Passwordless societyPasswordless society
Passwordless society명신 김
694 views59 Folien
DevOps and Azure Devops 소개, 동향, 그리고 기대효과 von
DevOps and Azure Devops 소개, 동향, 그리고 기대효과DevOps and Azure Devops 소개, 동향, 그리고 기대효과
DevOps and Azure Devops 소개, 동향, 그리고 기대효과명신 김
1.1K views35 Folien
Serverless design and adoption von
Serverless design and adoptionServerless design and adoption
Serverless design and adoption명신 김
181 views18 Folien

Más de 명신 김(20)

업무를 빼고 가치를 더하는 클라우드 기술 von 명신 김
업무를 빼고 가치를 더하는 클라우드 기술업무를 빼고 가치를 더하는 클라우드 기술
업무를 빼고 가치를 더하는 클라우드 기술
명신 김389 views
[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기 von 명신 김
[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기
[2020 Ignite Seoul]Azure에서 사용할 수 있는 컨테이너/오케스트레이션 기술 살펴보기
명신 김328 views
Best of Build Seoul 2019 Keynote von 명신 김
Best of Build Seoul 2019 KeynoteBest of Build Seoul 2019 Keynote
Best of Build Seoul 2019 Keynote
명신 김455 views
Passwordless society von 명신 김
Passwordless societyPasswordless society
Passwordless society
명신 김694 views
DevOps and Azure Devops 소개, 동향, 그리고 기대효과 von 명신 김
DevOps and Azure Devops 소개, 동향, 그리고 기대효과DevOps and Azure Devops 소개, 동향, 그리고 기대효과
DevOps and Azure Devops 소개, 동향, 그리고 기대효과
명신 김1.1K views
Serverless design and adoption von 명신 김
Serverless design and adoptionServerless design and adoption
Serverless design and adoption
명신 김181 views
Durable functions von 명신 김
Durable functionsDurable functions
Durable functions
명신 김258 views
Azure functions v2 announcement von 명신 김
Azure functions v2 announcementAzure functions v2 announcement
Azure functions v2 announcement
명신 김103 views
Azure functions von 명신 김
Azure functionsAzure functions
Azure functions
명신 김141 views
Azure event grid von 명신 김
Azure event gridAzure event grid
Azure event grid
명신 김245 views
Serverless, Azure Functions, Logic Apps von 명신 김
Serverless, Azure Functions, Logic AppsServerless, Azure Functions, Logic Apps
Serverless, Azure Functions, Logic Apps
명신 김257 views
Microservices architecture von 명신 김
Microservices architectureMicroservices architecture
Microservices architecture
명신 김343 views
Visual studio 2015를 활용한 개발 생산성 및 코드 품질 혁신 von 명신 김
Visual studio 2015를 활용한 개발 생산성 및 코드 품질 혁신Visual studio 2015를 활용한 개발 생산성 및 코드 품질 혁신
Visual studio 2015를 활용한 개발 생산성 및 코드 품질 혁신
명신 김152 views
Connect(); 2016 한시간 총정리 von 명신 김
Connect(); 2016 한시간 총정리Connect(); 2016 한시간 총정리
Connect(); 2016 한시간 총정리
명신 김178 views
크로스 플랫폼을 품은 오픈 소스 프레임워크 .NET Core von 명신 김
크로스 플랫폼을 품은 오픈 소스 프레임워크 .NET Core크로스 플랫폼을 품은 오픈 소스 프레임워크 .NET Core
크로스 플랫폼을 품은 오픈 소스 프레임워크 .NET Core
명신 김320 views
Coded UI test를 이용한 테스트 자동화 von 명신 김
Coded UI test를 이용한 테스트 자동화Coded UI test를 이용한 테스트 자동화
Coded UI test를 이용한 테스트 자동화
명신 김963 views
VS2015 C++ new features von 명신 김
VS2015 C++ new featuresVS2015 C++ new features
VS2015 C++ new features
명신 김255 views
Welcome to the microsoft madness von 명신 김
Welcome to the microsoft madnessWelcome to the microsoft madness
Welcome to the microsoft madness
명신 김70 views

불어오는 변화의 바람, From c++98 to c++11, 14

  • 1. 불어오는 변화의 바람 C++98 to C++11/14 김명신 부장 / Microsoft 옥찬호 대표 / C++ Korea
  • 3. Programming Language 2014 2009 2004 1999 1994 1989 C 1 2 2 1 1 1 Java 2 1 1 3 - - Objective-C 3 26 36 - - - C++ 4 3 3 2 2 2 C# 5 5 8 17 - - PHP 6 4 5 32 - - Python 7 6 6 22 22 - JavaScript 8 8 9 9 - - Visual Basic. NET 9 - - - - - Perl 10 7 4 4 10 21 Pascal 15 13 80 7 3 23 http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  • 5. Bjarne Stroustrup Known as D&E Leave no room for lower-level language below c++ What you don’t use you don’t pay for (zero-overhead principle)
  • 10. King of the Performance / $
  • 20. 불어오는 변화의 바람 C++98 to C++11/14 옥찬호 대표 / C++ Korea
  • 21. 목차 1. C++ Korea 소개 2. C++11/14 New Features 3. C++17 Features Preview 4. Related C++ Libraries
  • 23. C++ Korea • https://www.facebook.com/groups/cppkorea/ • 2013년 11월 개설 • 2014년 마이크로소프트 커뮤니티 멜팅팟 프로그램 2기 선정 • 2014년 10월 1기 운영진 선발 • 2014년 12월 멜팅팟 세미나 개최 • Effective Modern C++ 스터디 예정 • 자세한 사항은 그룹 공지사항 참조
  • 24. 페이스북 이벤트 • https://www.facebook.com/groups/cppkorea/ • C++ Korea 그룹에 가입하시고, 현장 사진을 올려주세요! • 세션 종료 후 추첨을 통해 2분을 선정하여 C++ 관련 서적을 드립니다. • 추첨 방법 : srand(NULL);
  • 25. ISO C++ Committee • http://isocpp.org/std/the-committee • ISO C++ 표준을 승인하는 기구 • 정기적으로 모여 새로운 C++ 표준에 추가하거나 변경, 삭제될 기능을 논의 • 여러 그룹으로 구성되어 있음
  • 28. Overview vector<vector<int>> user-defined literals thread_local =default, =delete atomic<T> auto f() -> int array<T, N> decltype vector<LocalType> noexcept regex initializer lists constexpr extern template C++ unordered_map<int, string>raw string literals nullptr auto i = v.begin(); async lambdas []{ foo(); } template aliases unique_ptr<T> shared_ptr<T> weak_ptr<T> thread, mutex for (x : coll) override, final variadic templates template <typename T…> function<> future<T> tuple<int, float, string> strongly-typed enums enum class E {…}; static_assert(x) rvalue references (move semantics) delegating constructors
  • 29. Overview vector<vector<int>> user-defined literals thread_local =default, =delete atomic<T> auto f() -> int array<T, N> decltype vector<LocalType> noexcept regex initializer lists constexpr extern template C++ unordered_map<int, string>raw string literals nullptr auto i = v.begin(); async lambdas []{ foo(); } template aliases unique_ptr<T> shared_ptr<T> weak_ptr<T> thread, mutex for (x : coll) override, final variadic templates template <typename T…> function<> future<T> tuple<int, float, string> strongly-typed enums enum class E {…}; static_assert(x) rvalue references (move semantics) delegating constructors
  • 30. Overview vector<vector<int>> user-defined literals thread_local =default, =delete atomic<T> auto f() -> int array<T, N> decltype vector<LocalType> noexcept regex initializer lists constexpr extern template C++ unordered_map<int, string>raw string literals nullptr auto i = v.begin(); async lambdas []{ foo(); } template aliases unique_ptr<T> shared_ptr<T> weak_ptr<T> thread, mutex for (x : coll) override, final variadic templates template <typename T…> function<> future<T> tuple<int, float, string> strongly-typed enums enum class E {…}; static_assert(x) rvalue references (move semantics) delegating constructors
  • 31. auto map<string, string>::const_iterator it = m.cbegin(); double const param = config["param"]; singleton& s = singleton::instance(); auto it = m.begin(); auto const param = config["param"]; auto& s = singleton::instance(); 컴파일 타임 추론
  • 32. decltype template<class T, class U> ??? add(T x, U y) { return x + y; } 템플릿 함수의 반환형은 컴파일 타임 때 알고 있어야 함
  • 33. decltype template<class T, class U> decltype(x+y) add(T x, U y) { return x + y; } decltype을 사용하면 컴파일 타임 때 반환형을 추론
  • 34. nullptr foo(NULL); #define NULL 0 void foo(char*); void foo(int); foo(nullptr);
  • 35. Strongly-typed Enums enum class Alert { green, yellow, red }; int lightColor = red; // 오류 Alert lightColor = Alert::red; int convertColor = static_cast<int>(Alert::red); enum Alert { green, yellow, red }; int lightColor = red; enum → int Conversion
  • 36. Uniform Initialization vector<int> v; v.push_back(10); v.push_back(20); map<int, string> labels; labels.insert(make_pair(1, “Open”)); labels.insert(make_pair(2, “Close”)); 데이터를 컨테이너에 각각 추가 추가하는 방법도 다름
  • 37. Uniform Initialization vector<int> v = {10, 20}; map<int, string> labels { {1, “Open”}, {2, “Close”} }; 데이터를 컨테이너에 일괄 추가 추가하는 방법도 같음 initializer_list<int> initializer_list<pair<int, string>>
  • 38. std::initializer_list template<class T> struct S { vector<T> v; S(initializer_list<T> l) : v(l) { } void append(initializer_list<T> l) { v.insert(v.end(), l.begin(), l.end()); } }; S<int> s = {1, 2, 3, 4, 5}; s.append({6, 7, 8}); S<char> t = {‘a’, ‘b’}; s.append({‘c’, ‘d’, ‘e’, ‘f’});
  • 39. Variadic Template template<class T> void print_list(T value) { cout << value << endl; } template<class First, class …Rest> void print_list(First first, Rest …rest) { cout << first <<“, “; print_list(rest…); }
  • 40. Variadic Template print_list(42, “hello”, 2.3, ‘a’); print_list(first = 42, …rest = “hello”, 2.3, ‘a’) 42 print_list(first = “hello”, …rest = 2.3, ‘a’) hello print_list(first = 2.3, …rest = ‘a’) 2.3 print_list(value = ‘a’) a 42, hello, 2.3, a template<class T> void print_list(T value) { … } 재귀 함수를 끝내기 위한 별도의 함수 필요
  • 41. Delegating Constructors class A { int a; void validate(int x) { if (x > 0 && x <= 42) a = x; } public: A(int x) { validate(x); } A() { validate(42); } A(string s) { int x = stoi(s); validate(x); } }; 생성자를 각각 구현하고, 별도의 함수 호출
  • 42. Delegating Constructors class A { int a; public: A(int x) { if (x > 0 && x <= 42) a = x; } A() : A(42) { } A(string s) : A(stoi(s)) { } }; 1개의 생성자를 구현한 뒤, 위임 호출
  • 44. C++17 Features Preview • Extended constants evaluation • Folding expressions • uncaught_exceptions • Forwarding references • u8 character literals • Nested namespace definitions • auto x{y}; • auto_ptr, bind1st/bind2nd, ptr_fun/mem_fun/mem_fun_ref, random_shuffle all removed
  • 45. Folding Expressions template <typename… Args> bool all(Args… args) { return (args && …); } bool b = all(true, true, true, false); bool b2 = all(); ((true && true) && true) && false
  • 46. Folding Expressions template <typename… Args> bool all(Args… args) { return (args && …); } bool b = all(true, true, true, false); bool b2 = all(); true
  • 48. Boost • http://www.boost.org • C++ 위원회 멤버들로부터 시작된 오픈 소스 라이브러리 • C++ 표준 라이브러리가 업데이트 될 때 Boost 라이브러리에 있는 많은 기능들이 채택됨 • Boost.Asio, Boost.Log, Boost.ScopeExit 등 • References • boost.org 문서 • Boost.Asio를 이용한 네트워크 프로그래밍 (한빛미디어, 2013)
  • 49. Case Studies : CGSF • https://github.com/pdpdds/CGSF • 캐주얼 게임을 위해 제작된 서버 라이브러리 • Boost.Asio를 커스터마이징해 네트워크 엔진으로 사용
  • 50. Qt • http://qt-project.org • GUI 프로그램 개발에 널리 쓰이는 크로스 플랫폼 프레임워크 • C++을 주로 사용하지만, Python, Ruby, C, Perl, Pascal과도 연동 • SQL DB 접근, XML 처리, Thread 관리, 파일 관리 API 제공 • References • qt-project.org 문서 • QT5 프로그래밍 가이드(성안당, 2014) • QT4를 이용한 C++ GUI 프로그래밍 (아이티씨, 2009)
  • 51. Case Studies • MuseScore – 작곡 프로그램 • Pada Software – 워드프로세서 • Tiled – 2D 타일 맵 에디터
  • 52. C++ AMP(Accelerated Massive Parallelism) • http://msdn.microsoft.com/ko-kr/library/hh265136.aspx • VS C++에서 GPGPU 프로그래밍 환경을 제공 • 또 다른 컴파일러나 다른 구문을 배울 필요가 없음 • C++ AMP는 DirectX의 DirectCompute 사용, Microsoft Vista 이상에서만 사용 가능 (DirectX10에서 지원) • References • MSDN 문서 • C++ AMP : Visual C++와 GPGPU를 이용한 대규모 병렬 프로그래밍 (한빛미디어, 2013)

Hinweis der Redaktion

  1. 먼저 C++ Korea 커뮤니티에 대한 소개를 간단히 하고, C++11/14에 추가된 새로운 기능들을 알아볼 것입니다. 다음, 차기 표준이 될 C++17에 추가될 기능 중 몇 가지를 미리 알아보고 관련된 C++ 라이브러리 몇 가지를 소개하며 세션을 마무리할 것입니다.
  2. 먼저 C++ Korea 커뮤니티에 대한 소개를 하겠습니다.
  3. C++ Korea는 변화하고 있는 C++ 표준에 대비하기 위해 한국 C++ 사용자들과의 정보 공유 및 교류를 목적으로 2013년 11월, 페이스북 그룹으로 개설되었습니다. 이후 꾸준한 노력 끝에 2014년 하반기 마이크로소프트 개발자 커뮤니티 멜팅팟 프로그램 2기에 선정되었습니다. 멜팅팟 프로그램 선정을 시작으로 10월 1기 운영진 8명을 선발했고, 오늘 멜팅팟 세미나를 개최하게 되었습니다. 앞으로 세미나 개최를 발판 삼아 Effective Modern C++ 스터디를 진행할 예정입니다. 자세한 사항은 그룹 공지사항을 참조해 주시길 바라며, 모던 C++에 관심 있는 여러분들의 많은 참여 부탁드립니다. 앞서 말씀드렸다시피, C++은 2011년도 C++11 표준을 발표한 이래로 3년마다 새로운 표준을 내놓고 있습니다. 올해는 C++14 표준을 발표했는데, 이렇게 새로운 표준을 제정하는 단체가 있습니다. 바로 ISO C++ 위원회입니다.
  4. C++ Korea는 변화하고 있는 C++ 표준에 대비하기 위해 한국 C++ 사용자들과의 정보 공유 및 교류를 목적으로 2013년 11월, 페이스북 그룹으로 개설되었습니다. 이후 꾸준한 노력 끝에 2014년 하반기 마이크로소프트 개발자 커뮤니티 멜팅팟 프로그램 2기에 선정되었습니다. 멜팅팟 프로그램 선정을 시작으로 10월 1기 운영진 8명을 선발했고, 오늘 멜팅팟 세미나를 개최하게 되었습니다. 앞으로 세미나 개최를 발판 삼아 Effective Modern C++ 스터디를 진행할 예정입니다. 자세한 사항은 그룹 공지사항을 참조해 주시길 바라며, 모던 C++에 관심 있는 여러분들의 많은 참여 부탁드립니다. 앞서 말씀드렸다시피, C++은 2011년도 C++11 표준을 발표한 이래로 3년마다 새로운 표준을 내놓고 있습니다. 올해는 C++14 표준을 발표했는데, 이렇게 새로운 표준을 제정하는 단체가 있습니다. 바로 ISO C++ 위원회입니다.
  5. ISO C++ 위원회는 ISO C++ 표준을 승인하는 기구로서, C++의 창시자인 비야네 스트롭스트룹, Exception C++ 시리즈의 저자인 허브 서터 등이 위원회 소속으로 있습니다. 이들은 정기적으로 모여 새로운 C++ 표준에 추가하거나 변경, 삭제될 기능들을 논의합니다. 오른쪽에 보시는 그림은 최근 C++14 표준화 작업을 완료하고 나서 찍은 기념 사진인데, C++의 표준을 제정하기 위해 많은 사람들이 노력하고 있다는 사실을 알 수 있습니다. C++ 위원회는 크게 2개의 Working Group으로 구성되어 있는데, 언어의 핵심 기능에 대한 작업을 담당하는 Core WG, C++과 관련된 라이브러리에 대한 작업을 담당하는 Library WG가 있습니다. WG 안에는 Study Group이라고 부르는 12개의 SG가 있으며, SG는 각자 맡은 분야에 따라 새로운 기능을 제안합니다. 한 예로, SG1 Concurrency & Parallelism에서 Parallel STL을 제안했으며, 현재 Codeplex에서 오픈 소스로 작업중입니다. 하지만, ISO C++ 위원회에서 새로운 표준을 발표하더라도 컴파일러가 지원하지 않으면 사용할 수 없습니다. 현재 Visual Studio는 C++11/14 표준을 어느 정도 지원하고 있을까요?
  6. 보고계신 표는 Visual Studio 2013 11월 CTP와 Visual Studio 2015에서 지원하고 있는 C++ 표준 기능을 나타내고 있습니다. 마이크로소프트에서는 C++11과 14를 동일한 표준으로 보고, 사용자들이 자주 사용하는 기능을 우선적으로 지원하고 있습니다. 개인적인 판단으로는 비교적 다른 컴파일러에 비해 C++ 표준 지원 시기는 늦지만, 그만큼 안정성을 보장한다고 생각합니다.
  7. 지금부터는 C++11/14 표준에 새롭게 추가된 주요 기능에 대해 알아보도록 하겠습니다.
  8. 다음은 C++11에 추가된 주요 기능입니다. auto, nullptr, lambda, rvalue references 등 많은 기능들이 보입니다.
  9. 이 중에서 주요 기능인 rvalue references, constexpr, lambda, async, future 등은 뒷 세션에서 자세히 알아보도록 하겠습니다.
  10. 이번 세션에서는 세미나가 끝난 뒤 돌아가셔서 바로 사용하실 수 있는 간단한 기능 몇 가지를 알아보도록 하겠습니다.
  11. 먼저, auto에 대한 설명을 드리도록 하겠습니다. 위에 보시는 예제들은 프로젝트 작업 중 자주 볼 수 있는 코드입니다. 첫 번째 예제를 보시면 반복문을 수행하기 위해 map의 const_iterator를 선언하고 있는데, map의 구조로 인해 불필요하게 입력해야 되는 경우가 많았습니다. 하지만, C++11의 auto를 사용하면 자동 추론을 통해 불필요한 입력을 간소화할 수 있습니다. map<string, string>>::const_iterator를 auto로 줄일 수 있다니, 정말 멋진 일이 아닐 수 없습니다. 다만, auto를 사용하실 때 주의하실 점이 두 가지 있습니다. 첫 번째는 auto가 완벽하진 않기 때문에 const나 레퍼런스 타입을 추론하지 못합니다. 두 번째, 세 번째 예제를 보시면 각각 const와 레퍼런스 타입으로 선언되어 있는데, auto를 사용하더라도 밑에 보시는 것과 같이 const와 &는 추론되지 않습니다. 두 번째로 주의하실 점은 auto를 사용하실 때는 =의 오른쪽에 있는 표현식으로 왼쪽의 타입을 컴파일 타임에 추론할 수 있어야 합니다. 만약 컴파일 타임에 타입을 추론할 수 없다면, 오류가 발생하게 됩니다. 이 두 가지만 주의하시면, 불필요하게 긴 타입을 auto로 대체해서 사용할 수 있을 것입니다.
  12. 다음은 decltype입니다. 다음 템플릿 예제를 한 번 보도록 하겠습니다. T 타입 x와 U 타입 y를 더한 결과를 반환하는 함수입니다. 이 때 T, U에 어떤 타입이 오냐에 따라 반환형이 달라지게 됩니다. 예를 들어, T 타입이 int, U 타입이 float이라면 반환형은 int + float이 되는데 정수형이 실수형으로 변환되므로 float이 됩니다. 다른 예를 들어봅시다. 만약 T 타입이 vector이고, U 타입이 int라면 반환형은 어떻게 될까요? 반환형이 vector + int가 되는데, 이를 어떻게 표현할 수 있을까요?
  13. C++ AMP에 대한 데모 예제를 하나 보여드리겠습니다.