SlideShare a Scribd company logo
1 of 33
boost day07
BOOST_PP
2009.11.02
서진택 , jintaeks@gmail.com
발표순서
• 문제제기
• BOOST_PP 를 이용한 해결
 Techniques
 자체반복 구현
• Q&A
2
문제제기
• 템플릿 프로그램을 할 경우 , 비슷한 패턴의
코드를 되풀이 해서 작성해야 하는 상황이
발생한다 .
– 델리게이트의 작성
– 부분 특수화의 경우
– 기타등등
3
비슷한 패턴이 반복되는 상황
가능한 해결책
1. 무시하고 되풀이되는 패턴을 되풀이 해서
작성한다 .
2. 전처리기를 적절하게 활용한다 .
3. BOOST_PP 를 활용한다 .
– Boost preprocessing library
– 기계적으로 되풀이 되는 코드는 기계적으로 생
성하는 것이 마땅
5
2 번째 해결책 : 전처리기를 적절하게 활용한다 .
소스는 죽 ~ 이어집니다
.
BOOST_PP 를 이용한 해결
• 전처리기 기본
• 매크로
– object-like macro
• #define 식별자 치환 - 목록
– function-like macro
• #define 식별자 (a0,a1,…,an-1) 치환 - 목록
• 매크로 인수
– , ( )
• 매크로 인수
– FOO( std::pair<int,long> ) // 인수 2 개
– FOO({int x=1,y=2;return x+y;}) // 인수 2 개
– FOO( (std::pair<int,long>) ) // 인수 1 개
– FOO(({int x=1,y=2;return x+y;})) // 인수 1 개
9
, 를 전달할 때는 BOOST_PP_COMMA 를
사용한다 .
Technique
18
template<int x> struct int_
{
static int const value = x;
typedef int_<x> type;
typedef int value_type;
operator int() const { return x; }
};
struct none {};
template<typename T0=none, typename T1=none, typename T2=none>
struct tiny_size : int_<3> {};
template<typename T0, typename T1>
struct tiny_size<T0,T1,none> : int_<2> {};
template<typename T0>
struct tiny_size<T0,none,none> : int_<1> {};
template<>
struct tiny_size<none,none,none> : int_<0> {};
모든 타입 파라미터에
대해 부분 특수화를
구현해야 한다 .
예 ) tiny_size 의 작성
19
void main()
{
std::cout << ods::tiny_size<int,int,int>::value << std::endl;
std::cout << ods::tiny_size<int>::value << std::endl;
//3
//1
// 계속하려면아무키나누르십시오 . . .
}//main()
template<class T0, class T1, class T1>
#define n 3
template<BOOST_PP_ENUM_PARAMS(n,
class T)>
20
21
struct none {};
template<typename T0=none, typename T1=none, typename T2=none>
struct tiny_size : int_<3> {};
#define TINY_print(z, n, data) data
#define TINY_size(z, n, unused) 
template<BOOST_PP_ENUM_PARAMS(n, class T)> 
struct tiny_size< 
BOOST_PP_ENUM_PARAMS(n, T) 
BOOST_PP_COMMA_IF(n) 
BOOST_PP_ENUM( 
BOOST_PP_SUB(TINY_MAX_SIZE,n), TINY_print, none) 
> 
: int_<n> {};
BOOST_PP_REPEAT( TINY_MAX_SIZE, TINY_size, ~ )
#undef TINY_size
#undef TINY_print
수평 되풀이로 구현한
예
n 이 1 인 경우의 확장
template<typename T0>
struct tiny_size<T0,none,none> :
int_<1> {};
되풀이 방법
• 수평 되풀이
– 전처리기 출력에서 같은 줄이 된다 .
• 디버깅이 거의 불가능하다 .
• 수직되풀이
– 지역반복
• 디버깅이 불편하다
– 파일반복
• 사소한 코드 패턴에 대해 .hpp 파일을 만들어야 한다 .
– 자체반복
22
예 ) 멤버함수 템플릿의 특수화
구현
KSystemState::PostStateEvent() 의 기존구현
23
24
class KSystemState
{
public:
template<typename T>
void _Push( const char* pszInEvent_, T inValue_ )
{
std::cout << pszInEvent_ << ":" << inValue_ << std::endl;
}//_Push()
template<typename T0>
void PostStateEvent( const char* pszInEvent, T0 in0 );
template<typename T0, typename T1>
void PostStateEvent( const char* pszInEvent, T0 in0, T1 in1 );
};//class KSystemState
25
template<typename T0>
void KSystemStateEvent::PostStateEvent( const char* pszInEvent, T0 in0 )
{
_Push( pszInEvent, in0 );
}
template<typename T0, typename T1>
void KSystemStateEvent::PostStateEvent( const char* pszInEvent, T0 in0,
T1 in1 )
{
_Push( pszInEvent, in0 );
_Push( pszInEvent, in1 );
}
26
KSystemStateEvent g_systemState;
void main()
{
g_systemState.PostStateEvent( "Input", 0 );
g_systemState.PostStateEvent( "Output", 1, "dummy" );
//Input:0
//Output:1
//Output:dummy
// 계속하려면아무키나누르십시오 . . .
}//main() 타입 인자를 2 개까지만 전달
할 수 있다 .
자체반복 구현
• 반복 구현을 한 파일안에 작성
27
28
#define POST_STATE_MAX_ARG 2
class KSystemStateEvent
{
public:
template<typename T>
void _Push( const char* pszInEvent_, T inValue_ )
{
std::cout << pszInEvent_ << ":" << inValue_ << std::endl;
}//_Push()
#define _POST_STATE_EVENT_TEMPLATE(z, n, unused) 
template<BOOST_PP_ENUM_PARAMS(n, typename T)> 
void PostStateEvent( const char* szInEvent_,
BOOST_PP_ENUM_PARAMS( n, T ) );
BOOST_PP_REPEAT_FROM_TO( 1,
BOOST_PP_ADD(POST_STATE_MAX_ARG,1),
_POST_STATE_EVENT_TEMPLATE, ~ )
#undef _POST_STATE_EVENT_TEMPLATE
};//class KSystemStateEvent
선언과 body 를 별도로 구현 .
먼전 선언 부분을 간단하게 구
현한다 .
29
#ifndef BOOST_PP_IS_ITERATING
1) 반복을 호출하는 부분 작성
#else // #ifndef BOOST_PP_IS_ITERATING
2) 되풀이 되는 패턴을 제공하는 부분 작성
#endif // #ifndef BOOST_PP_IS_ITERATING
KSystemState.hpp 파일 작성
30
#ifndef _KSYSTEMSTATE_INL
#define _KSYSTEMSTATE_INL
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#define _POST_ARG(z, n, unused) BOOST_PP_CAT(T,n) BOOST_PP_CAT(In,n)
#define _POST_PUSH(z, n, unused) _Push( pszInEvent, BOOST_PP_CAT(In,n) );
// generate specializations
#define BOOST_PP_ITERATION_LIMITS (1, POST_STATE_MAX_ARG)
#define BOOST_PP_FILENAME_1 "KSystemState.hpp" // this file
#include BOOST_PP_ITERATE()
#undef BOOST_PP_FILENAME_1
#undef BOOST_PP_ITERATION_LIMITS
#undef _POST_PUSH
#undef _POST_ARG
#endif // #ifndef _KSYSTEMSTATE_INL
1) 반복을 호출하는
부분
각각의 n 에 대해 자기자신
KSystemState.hpp 를
include 한다 .
31
#define n BOOST_PP_ITERATION()
template<BOOST_PP_ENUM_PARAMS(n, typename T)>
void KSystemStateEvent::PostStateEvent( const char* pszInEvent
, BOOST_PP_ENUM( n, _POST_ARG, ~) )
{
BOOST_PP_REPEAT( n, _POST_PUSH, ~ )
}
#undef n
2) 되풀이 되는 패턴을 제공하는
부분
각각의 n 에 대해 (n 이 1, 2 일 때 ) 확장된다 .
32
…
#define POST_STATE_MAX_ARG 4
class KSystemStateEvent
{
…
};//class KSystemStateEvent
#include "KSystemState.hpp"
KSystemStateEvent g_systemState;
void main()
{
g_systemState.PostStateEvent( "Input", 0 );
g_systemState.PostStateEvent( "Output", 1, "dummy", 1.2f, 0xff );
//Input:0
//Output:1
//Output:dummy
//Output:1.2
//Output:255
// 계속하려면아무키나누르십시오 . . .
}//main()
이제 자유롭게 아규먼트의 개
수만 정의하면 됩니다 ^^;
참고문헌
• David Abrahams, “C++ Template
Metaprogramming”, 정보문화사 , p.323
• http://agile.egloos.com/5026291
• http://www.boost.org/doc/libs/1_38_0/libs/pr
eprocessor/doc/index.html
33

More Related Content

What's hot

R 프로그래밍 기본 문법
R 프로그래밍 기본 문법R 프로그래밍 기본 문법
R 프로그래밍 기본 문법Terry Cho
 
R 프로그램의 이해와 활용 v1.1
R 프로그램의 이해와 활용 v1.1R 프로그램의 이해와 활용 v1.1
R 프로그램의 이해와 활용 v1.1happychallenge
 
Tensorflow regression 텐서플로우 회귀
Tensorflow regression 텐서플로우 회귀Tensorflow regression 텐서플로우 회귀
Tensorflow regression 텐서플로우 회귀beom kyun choi
 
R 스터디 두번째
R 스터디 두번째R 스터디 두번째
R 스터디 두번째Jaeseok Park
 
파이썬 스터디 2주차
파이썬 스터디 2주차파이썬 스터디 2주차
파이썬 스터디 2주차Han Sung Kim
 
React로 TDD 쵸큼 맛보기
React로 TDD 쵸큼 맛보기React로 TDD 쵸큼 맛보기
React로 TDD 쵸큼 맛보기Kim Hunmin
 
R 스터디 세번째
R 스터디 세번째R 스터디 세번째
R 스터디 세번째Jaeseok Park
 
빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)SeongHyun Ahn
 
R 스터디 네번째
R 스터디 네번째R 스터디 네번째
R 스터디 네번째Jaeseok Park
 
Es2015 Simple Overview
Es2015 Simple OverviewEs2015 Simple Overview
Es2015 Simple OverviewKim Hunmin
 
Processing 2nd Class: Variable
Processing 2nd Class: VariableProcessing 2nd Class: Variable
Processing 2nd Class: VariableMinGi KYUNG
 
KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613
KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613
KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613KTH, 케이티하이텔
 
클러스터링을 통한 패턴 추출
클러스터링을 통한 패턴 추출클러스터링을 통한 패턴 추출
클러스터링을 통한 패턴 추출kidoki
 
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개
[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개PgDay.Seoul
 
집단지성 프로그래밍 05-문서필터링-02
집단지성 프로그래밍 05-문서필터링-02집단지성 프로그래밍 05-문서필터링-02
집단지성 프로그래밍 05-문서필터링-02Kwang Woo NAM
 
MySQL 인덱스의 기초
MySQL 인덱스의 기초MySQL 인덱스의 기초
MySQL 인덱스의 기초Hoyoung Jung
 
Laravel 로 배우는 서버사이드 #4
Laravel 로 배우는 서버사이드 #4Laravel 로 배우는 서버사이드 #4
Laravel 로 배우는 서버사이드 #4성일 한
 
프로그래밍을 배우면 할 수 있는 일들
프로그래밍을 배우면 할 수 있는 일들프로그래밍을 배우면 할 수 있는 일들
프로그래밍을 배우면 할 수 있는 일들Jeong Ed
 
Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1PartPrime
 

What's hot (20)

R 프로그래밍 기본 문법
R 프로그래밍 기본 문법R 프로그래밍 기본 문법
R 프로그래밍 기본 문법
 
R 프로그램의 이해와 활용 v1.1
R 프로그램의 이해와 활용 v1.1R 프로그램의 이해와 활용 v1.1
R 프로그램의 이해와 활용 v1.1
 
Tensorflow regression 텐서플로우 회귀
Tensorflow regression 텐서플로우 회귀Tensorflow regression 텐서플로우 회귀
Tensorflow regression 텐서플로우 회귀
 
R 스터디 두번째
R 스터디 두번째R 스터디 두번째
R 스터디 두번째
 
파이썬 스터디 2주차
파이썬 스터디 2주차파이썬 스터디 2주차
파이썬 스터디 2주차
 
React로 TDD 쵸큼 맛보기
React로 TDD 쵸큼 맛보기React로 TDD 쵸큼 맛보기
React로 TDD 쵸큼 맛보기
 
R 스터디 세번째
R 스터디 세번째R 스터디 세번째
R 스터디 세번째
 
빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)빠르게 활용하는 파이썬3 스터디(ch1~4)
빠르게 활용하는 파이썬3 스터디(ch1~4)
 
R 스터디 네번째
R 스터디 네번째R 스터디 네번째
R 스터디 네번째
 
Es2015 Simple Overview
Es2015 Simple OverviewEs2015 Simple Overview
Es2015 Simple Overview
 
Processing 2nd Class: Variable
Processing 2nd Class: VariableProcessing 2nd Class: Variable
Processing 2nd Class: Variable
 
KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613
KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613
KTH_Detail day_화성에서 온 개발자 금성에서 온 기획자 시리즈_5차_데이터분석_조범석_20120613
 
클러스터링을 통한 패턴 추출
클러스터링을 통한 패턴 추출클러스터링을 통한 패턴 추출
클러스터링을 통한 패턴 추출
 
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개
[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개[Pgday.Seoul 2018]  PostgreSQL 11 새 기능 소개
[Pgday.Seoul 2018] PostgreSQL 11 새 기능 소개
 
집단지성 프로그래밍 05-문서필터링-02
집단지성 프로그래밍 05-문서필터링-02집단지성 프로그래밍 05-문서필터링-02
집단지성 프로그래밍 05-문서필터링-02
 
MySQL 인덱스의 기초
MySQL 인덱스의 기초MySQL 인덱스의 기초
MySQL 인덱스의 기초
 
Laravel 로 배우는 서버사이드 #4
Laravel 로 배우는 서버사이드 #4Laravel 로 배우는 서버사이드 #4
Laravel 로 배우는 서버사이드 #4
 
프로그래밍을 배우면 할 수 있는 일들
프로그래밍을 배우면 할 수 있는 일들프로그래밍을 배우면 할 수 있는 일들
프로그래밍을 배우면 할 수 있는 일들
 
Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1Deep learningwithkeras ch3_1
Deep learningwithkeras ch3_1
 
MySQL JOIN
MySQL JOINMySQL JOIN
MySQL JOIN
 

Viewers also liked

BEVERAGES - DEEMAH PRODUCT CATALOG
BEVERAGES - DEEMAH PRODUCT CATALOGBEVERAGES - DEEMAH PRODUCT CATALOG
BEVERAGES - DEEMAH PRODUCT CATALOGStanley Cayari
 
El futur del Transport Metropolità
El futur del Transport MetropolitàEl futur del Transport Metropolità
El futur del Transport MetropolitàAMTU
 
Irizar Group: la tecnologia del futur
Irizar Group: la tecnologia del futurIrizar Group: la tecnologia del futur
Irizar Group: la tecnologia del futurAMTU
 
Perdagangan islam
Perdagangan islamPerdagangan islam
Perdagangan islaminsan enom
 
Kodu Game Lab Tutorial
Kodu Game Lab Tutorial Kodu Game Lab Tutorial
Kodu Game Lab Tutorial marie95
 
Egomania: How Ego Makes Marketing Better. SXSWi Proposal
Egomania: How Ego Makes Marketing Better. SXSWi ProposalEgomania: How Ego Makes Marketing Better. SXSWi Proposal
Egomania: How Ego Makes Marketing Better. SXSWi ProposalTac Anderson
 
Leyes sobre discapacidad y rehabilitación
Leyes sobre discapacidad y rehabilitación Leyes sobre discapacidad y rehabilitación
Leyes sobre discapacidad y rehabilitación Osvaldo Toscano ILTEC
 
стандарт Ecdl
стандарт Ecdlстандарт Ecdl
стандарт Ecdlguest665fb
 
Presentation arbuznie-dety
Presentation arbuznie-detyPresentation arbuznie-dety
Presentation arbuznie-detyssmailcity
 
Fotos de niños
Fotos de niñosFotos de niños
Fotos de niñostobaruela
 
Pantallazo Logistica
Pantallazo LogisticaPantallazo Logistica
Pantallazo Logisticadavid
 
Byłam wróżką
Byłam wróżkąByłam wróżką
Byłam wróżkąsiloam
 

Viewers also liked (20)

BEVERAGES - DEEMAH PRODUCT CATALOG
BEVERAGES - DEEMAH PRODUCT CATALOGBEVERAGES - DEEMAH PRODUCT CATALOG
BEVERAGES - DEEMAH PRODUCT CATALOG
 
El futur del Transport Metropolità
El futur del Transport MetropolitàEl futur del Transport Metropolità
El futur del Transport Metropolità
 
Rout project8
Rout project8Rout project8
Rout project8
 
Rout project15
Rout project15Rout project15
Rout project15
 
Irizar Group: la tecnologia del futur
Irizar Group: la tecnologia del futurIrizar Group: la tecnologia del futur
Irizar Group: la tecnologia del futur
 
Ativ1 4-jozeli
Ativ1 4-jozeliAtiv1 4-jozeli
Ativ1 4-jozeli
 
Perdagangan islam
Perdagangan islamPerdagangan islam
Perdagangan islam
 
Gallery 3
Gallery 3Gallery 3
Gallery 3
 
Kodu Game Lab Tutorial
Kodu Game Lab Tutorial Kodu Game Lab Tutorial
Kodu Game Lab Tutorial
 
Rout Project5
Rout Project5Rout Project5
Rout Project5
 
Director
DirectorDirector
Director
 
автопарк + KAGIK
автопарк + KAGIKавтопарк + KAGIK
автопарк + KAGIK
 
James Miles
James MilesJames Miles
James Miles
 
Egomania: How Ego Makes Marketing Better. SXSWi Proposal
Egomania: How Ego Makes Marketing Better. SXSWi ProposalEgomania: How Ego Makes Marketing Better. SXSWi Proposal
Egomania: How Ego Makes Marketing Better. SXSWi Proposal
 
Leyes sobre discapacidad y rehabilitación
Leyes sobre discapacidad y rehabilitación Leyes sobre discapacidad y rehabilitación
Leyes sobre discapacidad y rehabilitación
 
стандарт Ecdl
стандарт Ecdlстандарт Ecdl
стандарт Ecdl
 
Presentation arbuznie-dety
Presentation arbuznie-detyPresentation arbuznie-dety
Presentation arbuznie-dety
 
Fotos de niños
Fotos de niñosFotos de niños
Fotos de niños
 
Pantallazo Logistica
Pantallazo LogisticaPantallazo Logistica
Pantallazo Logistica
 
Byłam wróżką
Byłam wróżkąByłam wróżką
Byłam wróżką
 

Similar to Boost pp 20091102_서진택

프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기Jongwook Choi
 
생체 광학 데이터 분석 AI 경진대회 1위 수상작
생체 광학 데이터 분석 AI 경진대회 1위 수상작생체 광학 데이터 분석 AI 경진대회 1위 수상작
생체 광학 데이터 분석 AI 경진대회 1위 수상작DACON AI 데이콘
 
Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택JinTaek Seo
 
레거시 시스템에 Django 들이밀기
레거시 시스템에 Django 들이밀기레거시 시스템에 Django 들이밀기
레거시 시스템에 Django 들이밀기Jiyong Jung
 
Effective c++ chapter7_8_9_dcshin
Effective c++ chapter7_8_9_dcshinEffective c++ chapter7_8_9_dcshin
Effective c++ chapter7_8_9_dcshinDong Chan Shin
 
Java mentoring of samsung scsc 2
Java mentoring of samsung scsc   2Java mentoring of samsung scsc   2
Java mentoring of samsung scsc 2도현 김
 
변수 이름의 효과
변수 이름의 효과변수 이름의 효과
변수 이름의 효과민욱 이
 
불어오는 변화의 바람, 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 명신 김
 
파이썬+클래스+구조+이해하기 20160310
파이썬+클래스+구조+이해하기 20160310파이썬+클래스+구조+이해하기 20160310
파이썬+클래스+구조+이해하기 20160310Yong Joon Moon
 
100511 boost&tips 최성기
100511 boost&tips 최성기100511 boost&tips 최성기
100511 boost&tips 최성기sung ki choi
 
Modern web application with meteor
Modern web application with meteorModern web application with meteor
Modern web application with meteorJaeho Lee
 
파이썬 스터디 15장
파이썬 스터디 15장파이썬 스터디 15장
파이썬 스터디 15장SeongHyun Ahn
 
5장 객체와클래스
5장 객체와클래스5장 객체와클래스
5장 객체와클래스SeoYeong
 
C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기Heo Seungwook
 
Clean code
Clean codeClean code
Clean codebbongcsu
 

Similar to Boost pp 20091102_서진택 (20)

HI-ARC PS 101
HI-ARC PS 101HI-ARC PS 101
HI-ARC PS 101
 
6 function
6 function6 function
6 function
 
프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기프로그래밍 대회: C++11 이야기
프로그래밍 대회: C++11 이야기
 
생체 광학 데이터 분석 AI 경진대회 1위 수상작
생체 광학 데이터 분석 AI 경진대회 1위 수상작생체 광학 데이터 분석 AI 경진대회 1위 수상작
생체 광학 데이터 분석 AI 경진대회 1위 수상작
 
06장 함수
06장 함수06장 함수
06장 함수
 
Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택Boost라이브러리의내부구조 20151111 서진택
Boost라이브러리의내부구조 20151111 서진택
 
레거시 시스템에 Django 들이밀기
레거시 시스템에 Django 들이밀기레거시 시스템에 Django 들이밀기
레거시 시스템에 Django 들이밀기
 
C++11
C++11C++11
C++11
 
Effective c++ chapter7_8_9_dcshin
Effective c++ chapter7_8_9_dcshinEffective c++ chapter7_8_9_dcshin
Effective c++ chapter7_8_9_dcshin
 
Java mentoring of samsung scsc 2
Java mentoring of samsung scsc   2Java mentoring of samsung scsc   2
Java mentoring of samsung scsc 2
 
C review
C  reviewC  review
C review
 
변수 이름의 효과
변수 이름의 효과변수 이름의 효과
변수 이름의 효과
 
불어오는 변화의 바람, 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
 
파이썬+클래스+구조+이해하기 20160310
파이썬+클래스+구조+이해하기 20160310파이썬+클래스+구조+이해하기 20160310
파이썬+클래스+구조+이해하기 20160310
 
100511 boost&tips 최성기
100511 boost&tips 최성기100511 boost&tips 최성기
100511 boost&tips 최성기
 
Modern web application with meteor
Modern web application with meteorModern web application with meteor
Modern web application with meteor
 
파이썬 스터디 15장
파이썬 스터디 15장파이썬 스터디 15장
파이썬 스터디 15장
 
5장 객체와클래스
5장 객체와클래스5장 객체와클래스
5장 객체와클래스
 
C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기
 
Clean code
Clean codeClean code
Clean code
 

More from JinTaek Seo

Neural network 20161210_jintaekseo
Neural network 20161210_jintaekseoNeural network 20161210_jintaekseo
Neural network 20161210_jintaekseoJinTaek Seo
 
05 heap 20161110_jintaeks
05 heap 20161110_jintaeks05 heap 20161110_jintaeks
05 heap 20161110_jintaeksJinTaek Seo
 
02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseo02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseoJinTaek Seo
 
Hermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksHermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksJinTaek Seo
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seoJinTaek Seo
 
03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksBeginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksBeginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksBeginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksBeginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...JinTaek Seo
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksBeginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksBeginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksBeginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksBeginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksJinTaek Seo
 

More from JinTaek Seo (20)

Neural network 20161210_jintaekseo
Neural network 20161210_jintaekseoNeural network 20161210_jintaekseo
Neural network 20161210_jintaekseo
 
05 heap 20161110_jintaeks
05 heap 20161110_jintaeks05 heap 20161110_jintaeks
05 heap 20161110_jintaeks
 
02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseo02 linked list_20160217_jintaekseo
02 linked list_20160217_jintaekseo
 
Hermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksHermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeks
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
 
03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
 
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksBeginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
 
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksBeginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
 
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
 
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksBeginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
 
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksBeginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeks
 
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksBeginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
 
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksBeginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
 
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksBeginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
 
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksBeginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
 

Recently uploaded

Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Wonjun Hwang
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Wonjun Hwang
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Kim Daeun
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionKim Daeun
 

Recently uploaded (6)

Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 

Boost pp 20091102_서진택

  • 2. 발표순서 • 문제제기 • BOOST_PP 를 이용한 해결  Techniques  자체반복 구현 • Q&A 2
  • 3. 문제제기 • 템플릿 프로그램을 할 경우 , 비슷한 패턴의 코드를 되풀이 해서 작성해야 하는 상황이 발생한다 . – 델리게이트의 작성 – 부분 특수화의 경우 – 기타등등 3
  • 5. 가능한 해결책 1. 무시하고 되풀이되는 패턴을 되풀이 해서 작성한다 . 2. 전처리기를 적절하게 활용한다 . 3. BOOST_PP 를 활용한다 . – Boost preprocessing library – 기계적으로 되풀이 되는 코드는 기계적으로 생 성하는 것이 마땅 5
  • 6. 2 번째 해결책 : 전처리기를 적절하게 활용한다 .
  • 7. 소스는 죽 ~ 이어집니다 .
  • 8. BOOST_PP 를 이용한 해결 • 전처리기 기본 • 매크로 – object-like macro • #define 식별자 치환 - 목록 – function-like macro • #define 식별자 (a0,a1,…,an-1) 치환 - 목록 • 매크로 인수 – , ( )
  • 9. • 매크로 인수 – FOO( std::pair<int,long> ) // 인수 2 개 – FOO({int x=1,y=2;return x+y;}) // 인수 2 개 – FOO( (std::pair<int,long>) ) // 인수 1 개 – FOO(({int x=1,y=2;return x+y;})) // 인수 1 개 9 , 를 전달할 때는 BOOST_PP_COMMA 를 사용한다 .
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. 18 template<int x> struct int_ { static int const value = x; typedef int_<x> type; typedef int value_type; operator int() const { return x; } }; struct none {}; template<typename T0=none, typename T1=none, typename T2=none> struct tiny_size : int_<3> {}; template<typename T0, typename T1> struct tiny_size<T0,T1,none> : int_<2> {}; template<typename T0> struct tiny_size<T0,none,none> : int_<1> {}; template<> struct tiny_size<none,none,none> : int_<0> {}; 모든 타입 파라미터에 대해 부분 특수화를 구현해야 한다 . 예 ) tiny_size 의 작성
  • 19. 19 void main() { std::cout << ods::tiny_size<int,int,int>::value << std::endl; std::cout << ods::tiny_size<int>::value << std::endl; //3 //1 // 계속하려면아무키나누르십시오 . . . }//main()
  • 20. template<class T0, class T1, class T1> #define n 3 template<BOOST_PP_ENUM_PARAMS(n, class T)> 20
  • 21. 21 struct none {}; template<typename T0=none, typename T1=none, typename T2=none> struct tiny_size : int_<3> {}; #define TINY_print(z, n, data) data #define TINY_size(z, n, unused) template<BOOST_PP_ENUM_PARAMS(n, class T)> struct tiny_size< BOOST_PP_ENUM_PARAMS(n, T) BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM( BOOST_PP_SUB(TINY_MAX_SIZE,n), TINY_print, none) > : int_<n> {}; BOOST_PP_REPEAT( TINY_MAX_SIZE, TINY_size, ~ ) #undef TINY_size #undef TINY_print 수평 되풀이로 구현한 예 n 이 1 인 경우의 확장 template<typename T0> struct tiny_size<T0,none,none> : int_<1> {};
  • 22. 되풀이 방법 • 수평 되풀이 – 전처리기 출력에서 같은 줄이 된다 . • 디버깅이 거의 불가능하다 . • 수직되풀이 – 지역반복 • 디버깅이 불편하다 – 파일반복 • 사소한 코드 패턴에 대해 .hpp 파일을 만들어야 한다 . – 자체반복 22
  • 23. 예 ) 멤버함수 템플릿의 특수화 구현 KSystemState::PostStateEvent() 의 기존구현 23
  • 24. 24 class KSystemState { public: template<typename T> void _Push( const char* pszInEvent_, T inValue_ ) { std::cout << pszInEvent_ << ":" << inValue_ << std::endl; }//_Push() template<typename T0> void PostStateEvent( const char* pszInEvent, T0 in0 ); template<typename T0, typename T1> void PostStateEvent( const char* pszInEvent, T0 in0, T1 in1 ); };//class KSystemState
  • 25. 25 template<typename T0> void KSystemStateEvent::PostStateEvent( const char* pszInEvent, T0 in0 ) { _Push( pszInEvent, in0 ); } template<typename T0, typename T1> void KSystemStateEvent::PostStateEvent( const char* pszInEvent, T0 in0, T1 in1 ) { _Push( pszInEvent, in0 ); _Push( pszInEvent, in1 ); }
  • 26. 26 KSystemStateEvent g_systemState; void main() { g_systemState.PostStateEvent( "Input", 0 ); g_systemState.PostStateEvent( "Output", 1, "dummy" ); //Input:0 //Output:1 //Output:dummy // 계속하려면아무키나누르십시오 . . . }//main() 타입 인자를 2 개까지만 전달 할 수 있다 .
  • 27. 자체반복 구현 • 반복 구현을 한 파일안에 작성 27
  • 28. 28 #define POST_STATE_MAX_ARG 2 class KSystemStateEvent { public: template<typename T> void _Push( const char* pszInEvent_, T inValue_ ) { std::cout << pszInEvent_ << ":" << inValue_ << std::endl; }//_Push() #define _POST_STATE_EVENT_TEMPLATE(z, n, unused) template<BOOST_PP_ENUM_PARAMS(n, typename T)> void PostStateEvent( const char* szInEvent_, BOOST_PP_ENUM_PARAMS( n, T ) ); BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_ADD(POST_STATE_MAX_ARG,1), _POST_STATE_EVENT_TEMPLATE, ~ ) #undef _POST_STATE_EVENT_TEMPLATE };//class KSystemStateEvent 선언과 body 를 별도로 구현 . 먼전 선언 부분을 간단하게 구 현한다 .
  • 29. 29 #ifndef BOOST_PP_IS_ITERATING 1) 반복을 호출하는 부분 작성 #else // #ifndef BOOST_PP_IS_ITERATING 2) 되풀이 되는 패턴을 제공하는 부분 작성 #endif // #ifndef BOOST_PP_IS_ITERATING KSystemState.hpp 파일 작성
  • 30. 30 #ifndef _KSYSTEMSTATE_INL #define _KSYSTEMSTATE_INL #include <boost/preprocessor/repetition.hpp> #include <boost/preprocessor/arithmetic/sub.hpp> #include <boost/preprocessor/punctuation/comma_if.hpp> #include <boost/preprocessor/iteration/iterate.hpp> #define _POST_ARG(z, n, unused) BOOST_PP_CAT(T,n) BOOST_PP_CAT(In,n) #define _POST_PUSH(z, n, unused) _Push( pszInEvent, BOOST_PP_CAT(In,n) ); // generate specializations #define BOOST_PP_ITERATION_LIMITS (1, POST_STATE_MAX_ARG) #define BOOST_PP_FILENAME_1 "KSystemState.hpp" // this file #include BOOST_PP_ITERATE() #undef BOOST_PP_FILENAME_1 #undef BOOST_PP_ITERATION_LIMITS #undef _POST_PUSH #undef _POST_ARG #endif // #ifndef _KSYSTEMSTATE_INL 1) 반복을 호출하는 부분 각각의 n 에 대해 자기자신 KSystemState.hpp 를 include 한다 .
  • 31. 31 #define n BOOST_PP_ITERATION() template<BOOST_PP_ENUM_PARAMS(n, typename T)> void KSystemStateEvent::PostStateEvent( const char* pszInEvent , BOOST_PP_ENUM( n, _POST_ARG, ~) ) { BOOST_PP_REPEAT( n, _POST_PUSH, ~ ) } #undef n 2) 되풀이 되는 패턴을 제공하는 부분 각각의 n 에 대해 (n 이 1, 2 일 때 ) 확장된다 .
  • 32. 32 … #define POST_STATE_MAX_ARG 4 class KSystemStateEvent { … };//class KSystemStateEvent #include "KSystemState.hpp" KSystemStateEvent g_systemState; void main() { g_systemState.PostStateEvent( "Input", 0 ); g_systemState.PostStateEvent( "Output", 1, "dummy", 1.2f, 0xff ); //Input:0 //Output:1 //Output:dummy //Output:1.2 //Output:255 // 계속하려면아무키나누르십시오 . . . }//main() 이제 자유롭게 아규먼트의 개 수만 정의하면 됩니다 ^^;
  • 33. 참고문헌 • David Abrahams, “C++ Template Metaprogramming”, 정보문화사 , p.323 • http://agile.egloos.com/5026291 • http://www.boost.org/doc/libs/1_38_0/libs/pr eprocessor/doc/index.html 33