모바일 오유 바로가기
http://m.todayhumor.co.kr
분류 게시판
베스트
  • 베스트오브베스트
  • 베스트
  • 오늘의베스트
  • 유머
  • 유머자료
  • 유머글
  • 이야기
  • 자유
  • 고민
  • 연애
  • 결혼생활
  • 좋은글
  • 자랑
  • 공포
  • 멘붕
  • 사이다
  • 군대
  • 밀리터리
  • 미스터리
  • 술한잔
  • 오늘있잖아요
  • 투표인증
  • 새해
  • 이슈
  • 시사
  • 시사아카이브
  • 사회면
  • 사건사고
  • 생활
  • 패션
  • 패션착샷
  • 아동패션착샷
  • 뷰티
  • 인테리어
  • DIY
  • 요리
  • 커피&차
  • 육아
  • 법률
  • 동물
  • 지식
  • 취업정보
  • 식물
  • 다이어트
  • 의료
  • 영어
  • 맛집
  • 추천사이트
  • 해외직구
  • 취미
  • 사진
  • 사진강좌
  • 카메라
  • 만화
  • 애니메이션
  • 포니
  • 자전거
  • 자동차
  • 여행
  • 바이크
  • 민물낚시
  • 바다낚시
  • 장난감
  • 그림판
  • 학술
  • 경제
  • 역사
  • 예술
  • 과학
  • 철학
  • 심리학
  • 방송연예
  • 연예
  • 음악
  • 음악찾기
  • 악기
  • 음향기기
  • 영화
  • 다큐멘터리
  • 국내드라마
  • 해외드라마
  • 예능
  • 팟케스트
  • 방송프로그램
  • 무한도전
  • 더지니어스
  • 개그콘서트
  • 런닝맨
  • 나가수
  • 디지털
  • 컴퓨터
  • 프로그래머
  • IT
  • 안티바이러스
  • 애플
  • 안드로이드
  • 스마트폰
  • 윈도우폰
  • 심비안
  • 스포츠
  • 스포츠
  • 축구
  • 야구
  • 농구
  • 바둑
  • 야구팀
  • 삼성
  • 두산
  • NC
  • 넥센
  • 한화
  • SK
  • 기아
  • 롯데
  • LG
  • KT
  • 메이저리그
  • 일본프로야구리그
  • 게임1
  • 플래시게임
  • 게임토론방
  • 엑스박스
  • 플레이스테이션
  • 닌텐도
  • 모바일게임
  • 게임2
  • 던전앤파이터
  • 마비노기
  • 마비노기영웅전
  • 하스스톤
  • 히어로즈오브더스톰
  • gta5
  • 디아블로
  • 디아블로2
  • 피파온라인2
  • 피파온라인3
  • 워크래프트
  • 월드오브워크래프트
  • 밀리언아서
  • 월드오브탱크
  • 블레이드앤소울
  • 검은사막
  • 스타크래프트
  • 스타크래프트2
  • 베틀필드3
  • 마인크래프트
  • 데이즈
  • 문명
  • 서든어택
  • 테라
  • 아이온
  • 심시티5
  • 프리스타일풋볼
  • 스페셜포스
  • 사이퍼즈
  • 도타2
  • 메이플스토리1
  • 메이플스토리2
  • 오버워치
  • 오버워치그룹모집
  • 포켓몬고
  • 파이널판타지14
  • 배틀그라운드
  • 기타
  • 종교
  • 단어장
  • 자료창고
  • 운영
  • 공지사항
  • 오유운영
  • 게시판신청
  • 보류
  • 임시게시판
  • 메르스
  • 세월호
  • 원전사고
  • 2016리오올림픽
  • 2018평창올림픽
  • 코로나19
  • 2020도쿄올림픽
  • 게시판찾기
  • 오유인페이지
    개인차단 상태
    황금비님의
    개인페이지입니다
    가입 : 13-10-13
    방문 : 2713회
    닉네임변경 이력
    회원차단
    회원차단해제
    게시물ID : humorbest_1207906
    작성자 : 황금비
    추천 : 45
    조회수 : 2691
    IP : 118.176.***.77
    댓글 : 3개
    베스트 등록시간 : 2016/02/22 11:07:19
    원글작성시간 : 2016/02/21 10:24:12
    http://todayhumor.com/?humorbest_1207906 모바일
    A Tour of C++ 발 번역
    옵션
    • 창작글
    <div><br></div> <div>이직하고 적응하느라 야근 철야.. 1년 반을 그렇게 보냈네요.</div> <div><br></div> <div><br></div> <div>작년에 <span style="color:#373a3c;font-family:'Open Sans', arial, 'Apple SD Gothic Neo', 'Noto Sans Korean', '본고딕', 'KoPubDotum Medium', '나눔바른고딕', '나눔고딕', NanumGothic, '맑은고딕', 'Malgun Gothic', sans-serif;font-size:14.4px;line-height:17.28px;">비야네 스트롭스트룹 교수의 </span>The C++ programming Language 4판 원서를 읽었습니다.</div> <div><br></div> <div>올해 1월에 번역서가 나와서 이 책도 구입을 해서 전부 읽었습니다.</div> <div><br></div> <div>중용한 번역서가 나와서 기뻤지만 아쉽게도 번역서는 오타가 참 많더 군요.</div> <div><br></div> <div>읽고 나서 혹시 잘못 번역한 내용으로 내가 잘못 이해하고 있지 않을까 하는 두려움이 있어서 최소한 책의 요약과 같은 advice 부분만은 직접 번역해 보는 것이 좋겠다는 생각이 들었습니다.</div> <div><br></div> <div>하다보니 A Tour of C++와 많이 겹치는 것을 알게 되었습니다.</div> <div><br></div> <div>The C++ programming Language 4판은 번역서가 있어서 아직 번역되지 않은 것을 해보는 것이 좋을 것 같아서 A Tour of C++의 advice 부분만 제 수준에 맞는 발 번역을 해보았습니다.</div> <div><br></div> <div>유려한 의역 보다는 중학교 수준에 맞는 단어와 문법을 활용한 직독 직해 발 번역의 충격을 미리 말씀 드리며...</div> <div><br></div> <div>암튼...</div> <div><br></div> <div><br></div> <div><br></div> <div><br></div> <div><br></div> <div>A Tour of C++ Advice번역</div> <div><br></div> <div>1 The Basics</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 5-6, 9-10, and 12 of  [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 5-6, 9-10, 그리고 12장과 거의 일치한다.</div> <div><br></div> <div>[2] Don't panic! All will become clear in time;</div> <div>당황하지 말아라. 때가 대면 모든 것이 분명해질 것이다.</div> <div><br></div> <div>[3] You don't have to know every detail of C++ to write good programs.</div> <div>좋은 프로그램을 작성하기 위해서 C++을 모두 자세히 할 필요는 없다.</div> <div><br></div> <div>[4] Focus on programming techniques, not on language features.</div> <div>언어의 기능이 아닌 프로그래밍 기법에 집중하라.</div> <div><br></div> <div>[5] For the final word on language definition issues, see the ISO C++ standard;</div> <div>언어 정의 이슈에 대한 최종 표명에 대해서 ISO C++ 표준을 보라.</div> <div><br></div> <div>[6] "Package" meaningful operations as carefully named functions;</div> <div>"패키지는" 주의 깊게 명명된 기능들의 의미있는 동작들이다.</div> <div><br></div> <div>[7] A function should perform a single logical operation;</div> <div>하나의 함수는 단일한 논리적인 연산을 수행해야한다.</div> <div><br></div> <div>[8] Keep functions short;</div> <div>함수를 짧게 유지하라</div> <div><br></div> <div>[9] Use overloading when functions perform conceptually the same task on different types;</div> <div>개념적으로 다른 타입에 같은 작업을 함수가 수행할 때 다중 정의(overloading)을 사용하라</div> <div><br></div> <div>[10] If a function may have to be evaluated at compile time, declare it constexpr;</div> <div>만약 함수가 컴파일 시간에 평가될 수 있다면 이 함수를 constexpr 로 선언하라</div> <div><br></div> <div>[11] Avoid "magic constants;" use symbolic constants;</div> <div>"마법 상수"를 피하라. 기호 상수를 사용하라</div> <div><br></div> <div>[12] Declare one name (only) per declaration.</div> <div>(오직) 선언당 하나의 이름을 선언하라</div> <div><br></div> <div>[13] Keep common and local names short, and keep uncommon and nonlocal names longer.</div> <div>공통으로 사용하는 것과 지역 이름은 짧게 유지하라. 그리고 공통으로 사용하지 않고 비지역적인 이름은 길게 유지하라</div> <div><br></div> <div>[14] Avoid similar-looking names.</div> <div>비슷하게 보이는 이름은 피하라</div> <div><br></div> <div>[15] Avoid ALL_CAPS names.</div> <div>"모두_대문자" 이름들은 피하라</div> <div><br></div> <div>[16] Prefer the {}-initializer syntax for declarations with a named type;</div> <div>이름이 있는 타입에 대해서 {}-초기화 문법을 선호하라</div> <div><br></div> <div>[17] Prefer the = syntax for the initialization in declarations using auto;</div> <div>auto를 사용한 선언에서 초기화에 대해서 = 문법을 선호하라</div> <div><br></div> <div>[18] Avoid uninitialized variables;</div> <div>초기화하지 않은 변수들을 피하라</div> <div><br></div> <div>[19] Keep scopes small; §1.6.</div> <div>(유효)범위를 최소화하라</div> <div><br></div> <div>[20] Keep use of pointers simple and straightforward;</div> <div>작게 그리고 복잡하지 않게 포인터의 사용을 유지하라</div> <div><br></div> <div>[21] Use nullptr rather than 0 or NULL;</div> <div>0 이나 NULL 보다 nullptr를 사용하라</div> <div><br></div> <div>[22] Don't declare a variable until you have a value to initialize it with;</div> <div>변수를 초기화할 값을 가질 때까지 변수를 선언하지 말아라</div> <div><br></div> <div>[23] Don't say in comments what can be clearly stated in code.</div> <div>코드에서 명확하게 명시해야할 것을 주석에서 말하지 말하라</div> <div><br></div> <div>[24] State intent in comments.</div> <div>주석에 의도를 명시하라</div> <div><br></div> <div>[25] Maintain a consistent indentation style.</div> <div>일관된 들여쓰기 스타일을 유지하라</div> <div><br></div> <div>[26] Avoid complicated expressions.</div> <div>복잡한 표현은 삼가하라</div> <div><br></div> <div>[27] Avoid narrowing conversions;</div> <div>축소 변환은 피하라</div> <div><br></div> <div>2 User-Defined Types</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapter 8 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 8장과 거의 일치한다.</div> <div><br></div> <div>[2] Organize related data into structures (structs or classes);</div> <div>연관된 데이터를 (구조체 혹은 클래스) 구조 안의 데이터로 구성하라</div> <div><br></div> <div>[3] Represent the distinction between an interface and an implemetation using a class;</div> <div>클래스를 사용해서 인터페이스와 구현 사이의 분리를 표현하라</div> <div><br></div> <div>[4] A struct is simply a class with its members public by default;</div> <div>구조체는 모든 멤버가 기본적으로 public인 단순한 클래스이다.</div> <div><br></div> <div>[5] Define constructors to guarantee and simplify initialization of classes;</div> <div>클래스의 초기화를 보증하고 단순화하기위해서 생성자를 정의하라</div> <div><br></div> <div>[6] Avoid "naked" unions; wrap them in a class together with a type field;</div> <div>클래스 안에서 타입 필드와 함께 감싼 이름이 없는 공용체는 피하라</div> <div><br></div> <div>[7] Use enumerations to represent sets of named constants;</div> <div>명명된 상수의 집합을 표현하기 위해서 열거형을 사용하라</div> <div><br></div> <div>[8] Prefer class enums over "plain" enums to minimize surprises;</div> <div>뜻밖의 사건을 최소화 하기위해서 단순한 enum보다 class enum을 사용하라</div> <div><br></div> <div>[9] Define operations on enumerations for safe and simple use;</div> <div>안정하고 단순한 사용을 위해서 열거형 동작을 정의하라</div> <div><br></div> <div><br></div> <div><br></div> <div>3 Modularity</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 13-15 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 13-15장과 거의 일치한다.</div> <div><br></div> <div>[2] Distinguish between declarations (used as interfaces) and definitions (used as implementations);</div> <div>(인터페이스로 사용될) 선언과 (구현으로 사용될) 정의를 구분하라</div> <div><br></div> <div>[3] Use header files to represent interfaces and to emphasize logical structure;</div> <div>인터페이스를 표현하고 지역 구조체를 강조 하기위해서 헤더파일을 사용하라</div> <div><br></div> <div>[4] ‪#‎include‬ a header in the source file that implements its functions;</div> <div>함수를 구현하는 원시 파일 안에 헤더파일을 #include 하라</div> <div><br></div> <div>[5] Avoid non-inline function definitions in headers;</div> <div>헤더에서 비-인라인 함수 정의를 피하라</div> <div><br></div> <div>[6] Use namespaces to express logical structure;</div> <div>논리적인 구조를 표현하기위해서 이름 공간을 사용하라</div> <div><br></div> <div>[7] Use using-directives for transition, for foundational libraries (such as std), or within a local scope;</div> <div>전이, 기초 라이브러리(std와 같은), 또는 지역 유효 범위안에서 using-지시문을 사용하라</div> <div><br></div> <div>[8] Don't put a using-directive in a header file;</div> <div>헤더 파일에 using-지시문을 넣지 말아라</div> <div><br></div> <div>[9] Throw an exception to indicate that you cannot perform an assigned task;</div> <div>할당된 작업을 수행할 수 없는 것을 나타 내기위해서 예외를 던져라</div> <div><br></div> <div>[10] Use exceptions for error handling;</div> <div>에러 관리를 위해서 예외를 사용하라</div> <div><br></div> <div>[11] Develop an error-handling strategy early in a design;</div> <div>(프로그램) 설계에서 에러-처리 전략을 미리 개발하라</div> <div><br></div> <div>[12] Use purpose-designed user-defined types as exceptions (not built-in types);</div> <div>(기본적으로 제공하는 타입보다) 예외를 목적으로 하는 사용자 정의 타입을 사용하라</div> <div><br></div> <div>[13] Don't try to catch every exception in every function;</div> <div>모든 함수에서 모든 예외를 잡을려고 하지 말아라</div> <div><br></div> <div>[14] If your function may not throw, declare it noexcept;</div> <div>함수가 예외를 던지지 않는 다면 nonexcept로 선언하라</div> <div><br></div> <div>[15] Let a constructor establish an invariant, and throw if it cannot;</div> <div>생성자를 불변성으로 만들어라. 그리고 할 수 없다면 예외를 던져라</div> <div><br></div> <div>[16] Design your error-handling strategy around invariants;</div> <div>에러-처리 전략과 불변성을 설계하라</div> <div><br></div> <div>[17] What can be checked at compile time is usually best checked at compile time (using static_assert);</div> <div>(static_assert을 사용해서) 컴파일 시간에 검사될 수 있는 것은 대개 가장 최고의 컴파일 시간 검사이다.</div> <div><br></div> <div><br></div> <div>4 Classes</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 16-22 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 16-22장과 거의 일치한다.</div> <div><br></div> <div>[2] Express ideas directly in code;</div> <div>아이디어를 코드에 직접 표현하라</div> <div><br></div> <div>[3] A concrete type is the simplest kind of class. Where applicable, prefer a concrete type over more complicated classes and over plain data structures;</div> <div>구체 타입은 가장 단순한 클래스의 한 종류 이다. 적용할 수 있는 곳에서, 복잡하게 구성된 클래스와 평범한 데이터 구조들보다 구체 타입을 좀 더 선호하라</div> <div><br></div> <div>[4] Use concrete classes to represent simple concepts and performance-critical components;</div> <div>간단한 concept과 성능-임계 컴포넌트를 표현 하기위해서 구체 클래스를 사용하라</div> <div><br></div> <div>[5] Define a constructor to handle initialization of objects;</div> <div>객체의 초기화를 관리하기 위해서 생성자를 정의하라</div> <div><br></div> <div>[6] Make a function a member only if it needs direct access to the representation of a class;</div> <div>오직 클래스의 표현을 직접 접근이 필요한 경우에 함수 멤머를 만들어라</div> <div><br></div> <div>[7] Define operators primarily to mimic conventional usage;</div> <div>통상적인 사용을 융내내기 위해서 연산자를 우선 정의하라</div> <div><br></div> <div>[8] Use nonmember functions for symmetric operators;</div> <div>대칭적인 연산에 대해서 비 멤버 함수를 사용하라</div> <div><br></div> <div>[9] Declare a member function that does not modify the state of its object const;</div> <div>객체 상수화의 상태를 수정하지 않는 멤버 함수를 사용하라</div> <div><br></div> <div>[10] If a constructor acquires a resource, its class needs a destructor to release the resource;</div> <div>만약 생성자가 자원을 요구한다면 클래스는 자원을 해제 하기위해서 소멸자를 필요로한다.</div> <div><br></div> <div>[11] Avoid "naked" new and delete operations;</div> <div>무방비의 new와 delete 연산을 피하라</div> <div><br></div> <div>[12] Use resource handles and RAII to manage resources;</div> <div>자원 관리를 위해서 자원 관리자와 RAII를 사용하라</div> <div><br></div> <div>[13] If a class is a container, give it an initializer-list constructor;</div> <div>클래스가 컨테이러라면 초기화 리스트 생성자를 주어라</div> <div><br></div> <div>[14] Use abstract classes as interfaces when complete separation of interface and implementation is needed;</div> <div>완전하게 인터레이스와 구현을 분리하는 것이 필요한 때에 추상 클래스를 인터페이스로 사용하라</div> <div><br></div> <div>[15] Access polymorphic objects through pointers and references;</div> <div>포인터와 참조자로 다형 객체를 접근하라</div> <div><br></div> <div>[16] An abstract class typically doesn't need a constructor;</div> <div>추상 클래스는 전형적으로 생성자를 필요로하지 않는다.</div> <div><br></div> <div>[17] Use class hierarchies to represent concepts with inherent hierarchical structure;</div> <div>계층적인 구조를 상속받는 copncept을 표현하기 위해서 클래스 계층을 사용하라</div> <div><br></div> <div>[18] A class with a virtual function should have a virtual destructor;</div> <div>가상함수가 있는 클래스는 가상 소멸자를 가져야 한다.</div> <div><br></div> <div>[19] Use override to make overriding explicit in large class hierarchies;</div> <div>거대한 클래스 계층에서 명시적으로 재정의를 만들기 위해서 override를 사용하라</div> <div><br></div> <div>[20] When designing a class hierarchy, distinguish between implementation inheritance and interface inheritance;</div> <div>클래스 계층을 설계할 때, 구현 상속과 인터페이스 상속을 구분하라</div> <div><br></div> <div>[21] Use dynamic_cast where class hierarchy navigation is unavoidable;</div> <div>클래스 계층 탐색을 피할 수 없다면 dynamic_cast를 사용하라</div> <div><br></div> <div>[22] Use dynamic_cast to a reference type when failure to find the required class is considered a failure;</div> <div>요구하는 클래스 찾기의 실패가 실패로 간주될 때 dynamic_cast를 참조자로 사용하라</div> <div><br></div> <div>[23] Use dynamic_cast to a pointer type when failure to find the required class is considered a valid alternative;</div> <div>요구하는 클래스 찾기의 실패가 유효한 선택으로 간주될 때 dynamic_cast를 포인터로 사용하라</div> <div><br></div> <div>[24] Use unique_ptr or shared_ptr to avoid forgetting to delete objects created using new;</div> <div>new를 사용해서 생성한 객체를 소멸하는 것을 잊는 것을 피하고 싶을 때 unique_ptr 또는 shared_ptr를 사용하라</div> <div><br></div> <div>[25] Redefine or prohibit copying if the default is not appropriate for a type;</div> <div>기본적으로 제공되는 것이 타입에 맞지 않는 다면 재정의하거나 또는 복사를 막아라</div> <div><br></div> <div>[26] Return containers by value (relying on move for efficiency);</div> <div>(효율적으로 이동 연산에 의존하는) 값으로 컨테이너를 반환하라</div> <div><br></div> <div>[27] For large operands, use const reference argument types;</div> <div>거대한 피연산자에 대해서, const 참조 인수 타입을 사용하라</div> <div><br></div> <div>[28] If a class has a destructor, it probably needs user-defined or deleted copy and move operations;</div> <div>만약 클래스가 소멸자를 가지고 있다면 그것은 아마도 사용자 정의 또는 소멸하는 복사 그리고 이동 연산을 필요로할 것이다.</div> <div><br></div> <div>[29] Control construction, copy, move, and destruction of objects;</div> <div>객체의 생성자, 복사, 이동 그리고 소멸자를 제어하라</div> <div><br></div> <div>[30] Design constructors, assignments, and the destructor as a matched set of operations;</div> <div>연산과 집합과 일치하는 것 생성자, 대입, 그리고 소멸자를 설계하라</div> <div><br></div> <div>[31] If a default constructor, assignment, or destructor is appropriate, let the compiler generate it (don't rewrite it yourself);</div> <div>기본 생성자, 대입, 또는 소멸자가 적합하다면 컴파일러가 그것을 만들도록 하라( 이러한 것을 다시 작성할 필요가 없다)</div> <div><br></div> <div>[32] By default, declare single-argument constructors explicit;</div> <div>기본적으로, 하나의 인수가 있는 생성자는 explict로 선언한다</div> <div><br></div> <div>[33] If a class has a pointer or reference member, it probably needs a destructor and non-default copy operations;</div> <div>만약 클래스가 포인터나 참조자 멤버를 가지고 있다면, 이것은 아마도 소멸자와 비-기본 복사 연산을 필요로할 것이다.</div> <div><br></div> <div>[34] Provide strong resource safety; that is, never leak anything that you think of as a resource;</div> <div>강한 자원 안전성을 제공하라; 즉, 결코 누수가 자원으로 생각할 수 없도록 한다.</div> <div><br></div> <div>[35] If a class is a resource handle, it needs a constructor, a destructor, and non-default copy operations;</div> <div>만약 클래스가 자원 관리자라면, 그것은 생성자, 소멸자, 그리고 비-기본 복사 연산을 필요로할 것이다.</div> <div><br></div> <div><br></div> <div><br></div> <div>5 Templates</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 20-29 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 20-29장과 거의 일치한다.</div> <div><br></div> <div>[2] Use templates to express algorithms that apply to many argument types;</div> <div>많은 인수 타입을 적용하는 알고리즘을 표현하기 위해서 템플릿을 사용하라</div> <div><br></div> <div>[3] Use templates to express containers;</div> <div>컨테이너를 표현하는 템플릿을 사용하라</div> <div><br></div> <div>[4] Use templates to raise the level of abstraction of code;</div> <div>코드의 추상화 수준을 올리기 위해서 템플릿을 사용하라</div> <div><br></div> <div>[5] When defining a template, first design and debug a non-template version; later generalize by adding parameters.</div> <div>첫번째로 비-템플릿 버전을 설계하고 디버깅하라. 후에 인수를 추가해서 일반화하라.</div> <div><br></div> <div>[6] Templates are type-safe, but checking happens too late;</div> <div>템플릿은 타입-안전이나, 늦게 검사된다.</div> <div><br></div> <div>[7] A template can pass argument types without loss of information.</div> <div>템플릿은 정보의 손실없이 인수 타입을 전달할 수 있다.</div> <div><br></div> <div>[8] Use function templates to deduce class template argument types;</div> <div>템플릿 인수 타입을 추론하기 위해서 함수 템플릿을 사용하라</div> <div><br></div> <div>[9] Templates provide a general mechanism for compile-time programming;</div> <div>템플릿은 컴파일-시간 프로그래밍을 위한 일반화 메커니즘을 제공한다</div> <div><br></div> <div>[10] When designing a template, carefully consider the concepts (requirements) assumed for its template arguments;</div> <div>템플릿을 설계하는데, concept의 템플릿 인수로 추정된 concept (요구사항)을 주의깊게 고려하라.</div> <div><br></div> <div>[11] Use concepts as a design tool;</div> <div>컨셉을 설계 도구로 사용하라.</div> <div><br></div> <div>[12] Use function objects as arguments to algoritms;</div> <div>함수 객체를 알고리즘의 인수로 사용하라</div> <div><br></div> <div>[13] Use a lambda if you need a simple function object in one place only;</div> <div>오직 한 장소에서 간단한 함수 객체가 필요하다면 람다를 사용하라</div> <div><br></div> <div>[14] A virtual function member cannot be a template member function.</div> <div>가상 함수 멤버는 템플릿 멤버가 될 수 없다.</div> <div><br></div> <div>[15] Use template aliases to simplify notation and hide implementation details;</div> <div>표기를 단순화하고 상세한 구현을 숨기기위해서 템플릿 별칭을 사용하라</div> <div><br></div> <div>[16] Use variadic templates when you need a function that takes a variable number of arguments of a variety of types;</div> <div>다양한 타입의 가변적인 숫자의 인수를 갖고 있는 함수가 필요하다면 가변인수 템플릿을 사용하라</div> <div><br></div> <div>[17] Don't use variadic templates for homogeneous argument lists (prefer initializer lists for that);</div> <div>동차 인수 리스트에 대해서 가변 인수 템플릿을 사용하지 말아라(동차 인수 리스트에 대해서 초기화 리스트를 선호하라)</div> <div><br></div> <div>[18] To use a template, make sure its definition (not just its declaration) is in scope;</div> <div>템플릿을 사용하고, (템플릿의 선언이 아닌) 템플릿의 정의는 휴효 범위안에 있도록 확실히 하라.</div> <div><br></div> <div>[19] Templates offer compile-time "duck typing";</div> <div>템플릿은 컴파일-시간 "덕 타이핍"을 제공한다.</div> <div><br></div> <div>[20] There is no separate compilation of templates: ‪#‎include‬ template definitions in every translation unit that uses them.</div> <div>템플릿의 분리 컴파일은 없다: 템플릿을 사용하는 모든 번역 단위 안에서 #include templete 하라</div> <div><br></div> <div><br></div> <div><br></div> <div>6 Library Overview</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapter 30 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 20-29장과 거의 일치한다.</div> <div><br></div> <div>[2] Don't reinvent the wheel; use libraries; §6.1.</div> <div>수레바퀴를 다시 만들지 말아라; 라이브러리를 사용하라</div> <div><br></div> <div>[3] When you have a choice, prefer the standard library over other libraries;</div> <div>선택이 있다면, 다른 라이브러리보다 표준 라이브러리를 사용하라</div> <div><br></div> <div>[4] Do not think that the standard library is ideal for everything;</div> <div>모든 것에서 표준 라이브러리가 이상적일 것이라는 생각은 하지 말아라</div> <div><br></div> <div>[5] Remember to ‪#‎include‬ the headers for the facilities you use;</div> <div>당신이 사용하고 있는 기능들에서 #include 헤더를 기억하라</div> <div><br></div> <div>[6] Remember that standard-library facilities are defined in namespace std;</div> <div>표준 라이브러리 기능은 namespace std; 안에 정의 되어 있다.</div> <div><br></div> <div><br></div> <div><br></div> <div>7 Strings and Regular Expressions</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 36-37 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 36-37장과 거의 일치한다.</div> <div><br></div> <div>[2] Prefer string operations to C-style string functions;</div> <div>C-스타일의 함수보다 (std)string 연산을 선호하라</div> <div><br></div> <div>[3] Use string to declare variables and members rather than as a base class;</div> <div>기반 클래스로보다 변수와 멤버를 선언하는 것으로 (std)string을 사용하라</div> <div><br></div> <div>[4] Return strings by value (rely on move semantics);</div> <div>값으로 (이동 의미 구조를 의존하는)string을 반환하라</div> <div><br></div> <div>[5] Directly or indirectly, use substr() to read substrings and replace() to write substrings;</div> <div>직접 혹은 간접적으로 하부 문자열을 읽기위해서 substr()을 사용하고 하부 문자열을 쓰기 위해서replace()를 사용하라</div> <div><br></div> <div>[6] A string can grow and shrink, as needed;</div> <div>필요에따라 string은 (메모리가) 커지거나 줄어든다</div> <div><br></div> <div>[7] Use at() rather than iterators or </div> <div>[] when you want range checking;</div> <div>범위 검사가 필요할 때 반복자나 </div> <div>[]보다 at()을 사용하라</div> <div><br></div> <div>[8] Use iterators and </div> <div>[] rather than at() when you want to optimize speed;</div> <div>속도 최적화를 원한다면 at()보다 반복자와 </div> <div>[]을 사용하라</div> <div><br></div> <div>[9] string input doesn't overflow;</div> <div>표준 input은 오버플로하지 않는다.</div> <div><br></div> <div>[10] Use c_str() to produce a C-style string representation of a string (only) when you have to;</div> <div>(오직) 필요한 경우의 문자열에만 C-스타일 문자열 표현을 생성하기 위해서 c_str()을 사용하라</div> <div><br></div> <div>[11] Use a string_stream or a generic value extraction function (such as to<X>) for numeric conversion of strings;</div> <div>string의 수치변환에 대해서 string_stream 또는 일반화 값 추출 함수(to<X>와 같은)를 사용하라.</div> <div><br></div> <div>[12] A basic_string can be used to make strings of characters on any type;</div> <div>basic_string 은 어떤 타입의 문자들로 문자열을 만드는 것으로 사용될 수 있다.</div> <div><br></div> <div>[13] Use regex for most conventional uses of regular expressions;</div> <div>가장 통상적인 정규 표현의 사용으로 regex 를 사용하라</div> <div><br></div> <div>[14] Prefer raw string literals for expressing all but the simplest patterns;</div> <div>가장 단순한 패턴을 제한 모두를 표현하는 것으로 가공되지 않은 문자열을 선호하라</div> <div><br></div> <div>[15] Use regex_match() to match a complete input;</div> <div>입력과 완전히 일치하는 것에 regex_match()을 사용하라</div> <div><br></div> <div>[16] Use regex_search() to search for a pattern in an input stream;</div> <div>입력 스트림안에 찾고자 하는 패턴에 regex_search()을 사용하라</div> <div><br></div> <div>[17] The regular expression notation can be adjusted to match various standards;</div> <div>정규 표현 표기법은 다양한 표준에 맞추기 위해서 조정될 수 있다.</div> <div><br></div> <div>[18] The default regular expression notation is that of ECMAScript;</div> <div>기본 정규 표현 표기법은 ECMA 스크립트이다.</div> <div><br></div> <div>[19] Be restrained; regular expressions can easily become a write-only language;</div> <div>제한하라; 정규 표현은 쉽게 쓰기-전용 언어가 될 수 있다.</div> <div><br></div> <div>[20] Note that \i allows you to express a subpattern in terms of a previous subpattern;</div> <div>\i는 이전 부분 패턴의 관점에서 부분 패턴을 표현할 수 있게함을 주목하라</div> <div><br></div> <div>[21] Use ? to make patterns "lazy";</div> <div>"게으른" 패턴을 만들기 위해서 ?을 사용하라</div> <div><br></div> <div>[22] Use regex_iterators for iterating over a stream looking for a pattern;</div> <div>패턴을 검색하는 스트림 순회로 regex_iterator를 사용하라</div> <div><br></div> <div><br></div> <div><br></div> <div>8 I/O Streams</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapter 38 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 38장과 거의 일치한다.</div> <div><br></div> <div>[2] iostreams are type-safe, type-sensitive, and extensible;</div> <div>iostream은 타입에 안전하고, 타입에 민감하며, 확장성이 있다.</div> <div><br></div> <div>[3] Define << and >> for user-defined types with values that have meaningful textual representations;</div> <div>의미있는 텍스트의 표현을 가지는 값이 있는 사용자 정의 타입을 위해서 << 와 >>을 정의하라</div> <div><br></div> <div>[4] Use cout for normal output and cerr for errors;</div> <div>일반적인 출력에서 cout을 사용하고 에러에 대해서 cerr를 사용하라</div> <div><br></div> <div>[5] There are iostreams for ordinary characters and wide characters, and you can define an iostream for any kind of character;</div> <div>일반 문자에 대한 것과 확장문자에 대한 iostream이 있으며, 어떤 종류의 문자에 대해서 iostream을 정의 할수 있다.</div> <div><br></div> <div>[6] Binary I/O is supported;</div> <div>이진 I/O는 제공이 된다.</div> <div><br></div> <div>[7] There are standard iostreams for standard I/O streams, files, and strings;</div> <div>표준 I/O 스트림, 파일, 그리고 문자열에대한 표준 iostream이 있다.</div> <div><br></div> <div>[8] Chain << operations for a terser notation;</div> <div>좀더 간결한 표기를 위해서 << 연산자를 연쇄적으로 사용하라</div> <div><br></div> <div>[9] Chain >> operations for a terser notation;</div> <div>좀더 간결한 표기를 위해서 >> 연산자를 연쇄적으로 사용하라</div> <div><br></div> <div>[10] Input into strings does not overflow;</div> <div>string으로 입력은 오버플로가 없다</div> <div><br></div> <div>[11] By default >> skips initial whitespace;</div> <div>기본적으로 >> (연산자)는 초기 공백을 지나친다.</div> <div><br></div> <div>[12] Use the stream state fail to handle potentially recoverable I/O errors;</div> <div>잠재적으로 극복할 수 있는 I/O 에러를 관리하기위해서 스트림 상태 실패를 사용하라</div> <div><br></div> <div>[13] You can define << and >> operators for your own types;</div> <div>당신의 자신의 타입으로 <<와 >> 연산자를 정의할 수 있다.</div> <div><br></div> <div>[14] You don't need to modify istream or ostream to add new << and >> operators;</div> <div>새로운 <<와 >>연산자를 추가하기 위해서 istream이나 ostream을 수정할 필요는 없다.</div> <div><br></div> <div>[15] Use manipulators to control formatting;</div> <div>서식화를 제어 하기 위해서 조작자를 사용하라</div> <div><br></div> <div>[16] precision() specifications apply to all following floating-point output operations;</div> <div>precision() 명세는 모든 딸려오는 부동소수점 출력 연산에 적용된다.</div> <div><br></div> <div>[17] Floating-point format specifications (e.g., scientific) apply to all following floating-point output operations;</div> <div>부동소수점 서식 명세는(예를 들어 scientific) 모든 딸려오는 부동소수점 출력 연산에 적용된다.</div> <div><br></div> <div>[18] ‪#‎include‬ <ios> when using standard manipulators;</div> <div>표준 조작자를 사용할 때 #include <ios>하라</div> <div><br></div> <div>[19] #include <iomanip> when using standard manipulators taking arguments;</div> <div>인수를 가진 표준 조작자를 사용할 때 #include <iomanip>하라</div> <div><br></div> <div>[20] Don't try to copy a file stream.</div> <div>파일 스트림 복사를 시도하지 말아라</div> <div><br></div> <div>[21] Remember to check that a file stream is attached to a file before using it;</div> <div>파일 스트림을 사용하기 전에 파일에 파일 스트림 부착 검사를 기억하라</div> <div><br></div> <div>[22] Use stringstreams for in-memory formatting;</div> <div>메모리-내부 서식화에서 stringstreams을 사용하라</div> <div><br></div> <div>[23] You can define conversions between any two types that both have string representation;</div> <div>둘다 문자열 표현을 가지는 어떤 두 타입 사이에서 변환을 정의할 수 있다.</div> <div><br></div> <div><br></div> <div><br></div> <div>9 Containers</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapter 31 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 31장과 거의 일치한다.</div> <div><br></div> <div>[2] An STL container defines a sequence;</div> <div>STL 컨테이너는 시퀀스를 정의한다</div> <div><br></div> <div>[3] STL containers are resource handles;</div> <div>STL 컨네이너는 자원 핸들이다.</div> <div><br></div> <div>[4] Use vector as your default container;</div> <div>기본 컨테이너로 vector를 사용하라</div> <div><br></div> <div>[5] For simple traversals of a container, use a range-for loop or a begin/end pair of iterators;</div> <div>간단한 컨테이너의 순회에서 범위 기반 for 또는 begin/end 쌍의 반복자를 사용하라</div> <div><br></div> <div>[6] Use reserve() to avoid invalidating pointers and iterators to elements;</div> <div>원소에 대한 유효하지 포인터와 반복자를 피하기 위해서 reserve()를 사용하라</div> <div><br></div> <div>[7] Don't assume performance benefits from reserve() without measurement;</div> <div>측정없이 reserve()로 부터 성능 잇점을 가정하지 말아라</div> <div><br></div> <div>[8] Use push_back() or resize() on a container rather than realloc() on an array;</div> <div>배열에 realloc() 보다 컨테이너에 push_back() 또는 resize()를 사용하라</div> <div><br></div> <div>[9] Don't use iterators into a resized vector;</div> <div>(벡터 케퍼서티가 변하면 반복자는 무효화 되기 때문에) 길이가 변경된 vector에 반복자를 사용하지 말아라</div> <div><br></div> <div>[10] Do not assume that [] range checks;</div> <div>[] 가 범위 검사 한다는 가정은 하지 말아라</div> <div><br></div> <div>[11] Use at() when you need guaranteed range checks;</div> <div>보증된 범위 검사를 필요로 한다면 at()을 사용하라</div> <div><br></div> <div>[12] Elements are copied into a container;</div> <div>원소들은 컨테이너로 복사될 수 있다.</div> <div><br></div> <div>[13] To preserve polymorphic behavior of elements, store pointers;</div> <div>원소의 다형적인 행위를 유지하기 위해서, 포인터를 적재하라</div> <div><br></div> <div>[14] Insertion operators, such as insert() and push_back() are often surprisingly efficient on a vector;</div> <div>insert() 과 push_back() 같은, 삽입 연산은 벡터에서 종종 놀랍게도 효과적일 때가 있다.</div> <div><br></div> <div>[15] Use forward_list for sequences that are usually empty;</div> <div>시퀀스가 대개 비어 있어 있는 경우에 forward_listf를 사용하라</div> <div><br></div> <div>[16] When it comes to performance, don't trust your intuition: measure;</div> <div>성능에 대해서, 직관을 믿지 말아라: 측정하라.</div> <div><br></div> <div>[17] A map is usually implemented as a red-black tree;</div> <div>map은 대게 red-black 트리로 구현된다.</div> <div><br></div> <div>[18] An unordered_map is a hash table;</div> <div>unordered_map은 해시 테이블이다.</div> <div><br></div> <div>[19] Pass a container by reference and return a container by value;</div> <div>참조자로 컨테이너를 전달하고 값으로 컨테이너를 반환하라</div> <div><br></div> <div>[20] For a container, use the ()-initializer syntax for sizes and the {}-initializer syntax for lists of elements;</div> <div>컨테이너에 대해서, 크기에 대해서 ()-초기화 문법을 사용하고, 원소의 리스트에 대해서 {}-초기화 문법을 사용하라</div> <div><br></div> <div>[21] Prefer compact and contiguous data structures;</div> <div>꽉차고 연속적인 데이터 구조를 선호하라</div> <div><br></div> <div>[22] A list is relatively expensive to traverse;</div> <div>리스트는 상대적으로 순회에서 (비용이) 비싸다</div> <div><br></div> <div>[23] Use unordered containers if you need fast lookup for large amounts of data;</div> <div>데이터의 거대한 용량에서 빠른 검색이 필요하다면 비순서화 컨테이너를 사용하라</div> <div><br></div> <div>[24] Use ordered associative containers (e.g., map and set) if you need to iterate over their elements in order;</div> <div>순서대로 컨테이너의 원소를 순회할 필요가 있다면 순서화 연관 컨테이너(예를 들어, map과 set)를 사용하라</div> <div><br></div> <div>[25] Use unordered containers for element types with no natural order (e.g., no reasonable <);</div> <div>자연적인 순서(예를 들어, 타당한 <이 없는) 원소의 타입에 비순서화 연관 컨테이너를 사용하라</div> <div><br></div> <div>[26] Experiment to check that you have an acceptable hash function;</div> <div>수용할 수 있는 해시 함수를 가지고 있는지 검사하기 위해서 실험하라</div> <div><br></div> <div>[27] Hash function obtained by combining standard hash functions for elements using exclusive or are often good;</div> <div>배타적 or를 사용하는 원소들과 표준 해시 함수들의 조합으로 얻어진 해시 함수들은 종종 훌륭하다</div> <div><br></div> <div>[28] Know your standard-library containers and prefer them to hand-crafted data structures;</div> <div>당신의 표준 라이브러리 컨테이너를 알아라 그리고 손으로 만든 데이터 구조보다 표준 라이브러리 컨테이너를 선호하라</div> <div><br></div> <div><br></div> <div><br></div> <div>10 Algorithms</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapter 32 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013]의 32장과 거의 일치한다.</div> <div><br></div> <div>[2] An STL algorithm operates on one or more sequences;</div> <div>STL 알고리즘은 하나 또는 그 이상의 시퀀스 위에서 동작한다.</div> <div><br></div> <div>[3] An input sequence is half-open and defined by a pair of iterators;</div> <div>입력 시퀀스는 반-개방이고 반복자 쌍으로 정의된다</div> <div><br></div> <div>[4] When searching, an algorithm usually returns the end of the input sequence to indicate "not found";</div> <div>검색에서 알고리즘은 대개 "찾을 수 없음"을 지시하기 위해서 입력 시퀀스의 end를 반환한다.</div> <div><br></div> <div>[5] Algorithms do not directly add or subtract elements from their argument sequences;</div> <div>알고리즘은 인수 시퀀스로부터 원소들을 직접 추가 되거나 제거되지 않는다</div> <div><br></div> <div>[6] When writing a loop, consider whether it could be expressed as a general algorithm;</div> <div>루프를 작성할 때 일반화 알고리즘으로 표현할 수 있는 지 고려하라.</div> <div><br></div> <div>[7] Use predicates and other function objects to give standard algorithms a wider range of meanings;</div> <div>표준 알고리즘에 좀 더 넒은 의미의 범위를 주기 위해서 술어 함수와 다른 함수 객체를 사용하라</div> <div><br></div> <div>[8] A predicate must not modify its argument;</div> <div>술어함수는 (자신의) 인수를 수정하지 말아야 한다.</div> <div><br></div> <div>[9] Know your standard-library algorithms and prefer them to hand-crafted loops;</div> <div>표준 라이브러리 알고리즘을 알아라 그리고 손으로 만든 루프보다 표준 라이브러리 알고리즘을 선호하라</div> <div><br></div> <div>[10] When the pair-of-iterators style becomes tedious, introduce a container/range algorithm;</div> <div>반복자의 쌍 스타일이 지겨워 질 때, 컨테이너/범위 알고리즘을 도입하라.</div> <div><br></div> <div><br></div> <div><br></div> <div>11 Utilities</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 33-35 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 33-35장에 있는 것과 거의 일치한다.</div> <div><br></div> <div>[2] A library doesn't have to be large or complicated to be useful;</div> <div>라이브러리는 사용하기에 거대하거나 복잡할 필요는 없다.</div> <div><br></div> <div>[3] A resource is anything that has to be acquired and (explicitly or implicitly) released;</div> <div>자원은 획득 되거나 (명시적 또는 암시적으로) 해제되어야 하는어떤 것이다.</div> <div><br></div> <div>[4] Use resource handles to manage resources (RAII);</div> <div>자원을 관리하기 위해서 자원 핸들을 사용하라(RAII)</div> <div><br></div> <div>[5] Use unique_ptr to refer to objects of polymorphic type;</div> <div>다형적인 타입의 객체들을 참조하기 위해서 unique_ptr을 사용하라</div> <div><br></div> <div>[6] Use shared_ptr to refer to shared objects;</div> <div>공유된 객체를 참조하기 위해서shared_ptr를 사용하라</div> <div><br></div> <div>[7] Prefer resource handles with specific semantics to smart pointers;</div> <div>스마트 포인터보다 특정한(명세된) 의미 구조를 가진 자원 핸들을 선호하라</div> <div><br></div> <div>[8] Prefer unique_ptr to shared_ptr;</div> <div>shared_ptr 보다 unique_ptr를 선호하라</div> <div><br></div> <div>[9] Prefer smart pointers to garbage collection;</div> <div>가비지 컬랙션보다 스마트 포인터를 선호하라</div> <div><br></div> <div>[10] Use array where you need a sequence with a constexpr size;</div> <div>constexpr 크기를 가진 시퀀스가 필요하다면 (std::)array를 사용하라</div> <div><br></div> <div>[11] Prefer array over built-in arrays;</div> <div>기본형 배열보다 (std::)array를 사용하라</div> <div><br></div> <div>[12] Use bitset if you need N bits and N is not necessarily the number of bits in a built-in integer type;</div> <div>만약 N 비트가 필요하고 기본 정수형 타입에서 N이 비트의 숫자일 필요가 없다면 bitset을 사용하라</div> <div><br></div> <div>[13] When using pair, consider make_pair() for type deduction;</div> <div>pair를 사용할 때, 타입 추론을 위한 make_pair()를 고려하라</div> <div><br></div> <div>[14] When using tuple, consider make_tuple() for type deduction;</div> <div>tuple을 사용할 때, 타입 추론을 위한 make_tuple()을 고려하라</div> <div><br></div> <div>[15] Time your programs before making claims about efficiency;</div> <div>효율성을 요구하기 전에 당신의 프로그램 시간을 측정하라</div> <div><br></div> <div>[16] Use duration_cast to report time measurements with proper units;</div> <div>적당한 단위의 시간 측정을 보고 하기 위해서 duration_cast를 사용하라</div> <div><br></div> <div>[17] Often, a lambda is an alternative to using bind() or mem_fn();</div> <div>때로는, 람다는 bind()나 mem_fn() 사용의 대안이다.</div> <div><br></div> <div>[18] Use bind() to create variants of functions and function objects;</div> <div>함수와 함수 객체의 변형을 만들기 위해서 bind()를 사용하라</div> <div><br></div> <div>[19] Use mem_fn() to create function objects that can invoke a member function when called using the traditional function call notation;</div> <div>기존의 함수 호출 표기를 사용해서 호출되는 멤버 함수를 호출 할 수 있는 함수 객체를 생성하기 위해서 mem_fn() 을 사용하라</div> <div><br></div> <div>[20] Use function when you need to store something that can be called;</div> <div>호출 될 수 있는 어떤 것을 저장할 필요가 있다면 함수를 사용하라</div> <div><br></div> <div>[21] You can write code to explicitly depend on properties of types;</div> <div>명시적으로 타입의 속성에 의존하는 코드를 작성할 수 있다.</div> <div><br></div> <div><br></div> <div><br></div> <div>12 Numerics</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapter 40 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 40장에 거의 일치한다.</div> <div><br></div> <div>[2] Numerical problems are often subtle. If you are not 100% certain about the mathematical aspects of a numerical problem, either take expert advice, experiment, or do both;</div> <div>수치 문제는 종종 어렵다. 만약 수치문제의 수학적 측면에서 100% 확신이 없다면, 전문가의 충고를 얻거나 실험하거나, 둘다 해야한다.</div> <div><br></div> <div>[3] Don't try to do serious numeric computation using only the bare language; use libraries;</div> <div>오직 언어 만을 사용해서 중대한 수치 계산을 시도하지말아라; 라이브러리를 사용하라</div> <div><br></div> <div>[4] Consider accumulate(), inner_product(), partial_sum(), and adjacent_difference() before you write a loop to compute a value from a sequence;</div> <div>시퀀스로부터 값을 계산하기 위해서 루프를 작성하기 전에 accumulate(), inner_product(), partial_sum(), 그리고 adjacent_difference() 를 고려하라</div> <div><br></div> <div>[5] Use std::complex for complex arithmetic;</div> <div>복소수 산술 연산에 std::complex를 사용하라</div> <div><br></div> <div>[6] Bind an engine to a distribution to get a random number generator;</div> <div>난수 생성기를 얻기 위해서 엔진에 분포를 결합하라</div> <div><br></div> <div>[7] Be careful that your random numbers are sufficiently random;</div> <div>난수가 충분히 무작위가 될 수 있도록 주의하라</div> <div><br></div> <div>[8] Use valarray for numeric computation when run-time efficiency is more important than flexibility with respect to operations and element types;</div> <div>연산과 원소의 타입을 고려하는 유연성보다 실시간 효율성이 좀 더 중요하다면 수치 계산에 대해서 valarray를 사용하라.</div> <div><br></div> <div>[9] Properties of numeric types are accessible through numeric_limits;</div> <div>수치 타입의 속성은 numeric_limits 통해서 접근할 수 있다.</div> <div><br></div> <div>[10] Use numeric_limits to check that the numeric types are adequate for their use;</div> <div>수치 타입을 사용하는데 이 수치 타입이 적합한 지를 검사하기 위해서 numeric_limits을 사용하라</div> <div><br></div> <div><br></div> <div><br></div> <div>13 Concurrency</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 41-42 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013] 41-42장과 거의 일치한다.</div> <div><br></div> <div>[2] Use concurrency to improve responsiveness or to improve throughput;</div> <div>응답성 또는 처리량을 개성하기 위해서 병행성을 사용하라</div> <div><br></div> <div>[3] Work at the highest level of abstraction that you can afford;</div> <div>할 수 있는 한 추상화의 최상위 수준에서 작업하라</div> <div><br></div> <div>[4] Consider processes as an alternative to threads;</div> <div>프로세스를 스레드의 대안으로 고려하라</div> <div><br></div> <div>[5] The standard-library concurrency facilities are type safe;</div> <div>표준 라이브러리 병행성 기능은 타입 안전하다</div> <div><br></div> <div>[6] The memory model exists to save most programmers from having to think about the machine architecture level of computers;</div> <div>메모리 모델은 대부분의 프로그래머를 컴퓨터의 기계 구조 수준에 관한 고민을 해야만 하는 것으로부터 구출하기 위해서 존재한다</div> <div><br></div> <div>[7] The memory model makes memory appear roughly as naively expected;</div> <div>메모리 모델은 메모리를 단순하게 기대한 모양으로 거의 나타내게한다.</div> <div><br></div> <div>[8] Atomics allow for lock-free programming;</div> <div>원자성은 무잠금(lock-free) 프로그램을 허락한다.</div> <div><br></div> <div>[9] Leave lock-free programming to experts;</div> <div>lock-free 프로그래밍은 전문가에게 남겨두어라</div> <div><br></div> <div>[10] Sometimes, a sequential solution is simpler and faster than a concurrent solution;</div> <div>때로는, 병행성 해결책보다 순차적인 해결책이 좀 더 단순하고 빠르다.</div> <div><br></div> <div>[11] Avoid data races;</div> <div>데이터 경합을 피하라</div> <div><br></div> <div>[12] A thread is a type-safe interface to a system thread;</div> <div>스레드는 시스템 스레드에 대해서 타입-안전한 인터페이스이다.</div> <div><br></div> <div>[13] Use join() to wait for a thread to complete;</div> <div>스레드가 완료를 기다리기 위해서 join()을 사용하라</div> <div><br></div> <div>[14] Avoid explicitly shared data whenever you can;</div> <div>할 수 있다면 명시적으로 공유되는 데이터는 피하라</div> <div><br></div> <div>[15] Use unique_lock to manage mutexes;</div> <div>mutexe를 관리하기 위해서 unique_lock을 사용하라</div> <div><br></div> <div>[16] Use lock() to acquire multiple locks;</div> <div>다중 lock을 얻기 위해 lock()을 사용하라</div> <div><br></div> <div>[17] Use condition_variables to manage communication among threads;</div> <div>스레드 사이의 통신을 관리하기 위해서 condition_variable을 사용하라</div> <div><br></div> <div>[18] Think in terms of tasks that can be executed concurrently, rather than directly in terms of threads;</div> <div>직접적으로 스레드의 관점보다 병행적으로 실행이 될 수 있는 테스크의 관점에서 생각하라.</div> <div><br></div> <div>[19] Value simplicity;</div> <div>값은 단순하게</div> <div><br></div> <div>[20] Prefer packaged_task and futures over direct use of threads and mutexes;</div> <div>직접적인 스레드의 사용과 mutex보다 packaged_task와 future를 선호하라</div> <div><br></div> <div>[21] Return a result using a promise and get a result from a future;</div> <div>primise를 사용한 결과를 반환하고 future로부터의 결과를 얻어라</div> <div><br></div> <div>[22] Use packaged_tasks to handle exceptions thrown by tasks and to arrange for value return;</div> <div>task로 던져진 예외를 처리하고 값 반환을 준비하기 위해서 packaged_task를 사용하라</div> <div><br></div> <div>[23] Use a packaged_task and a future to express a request to an external service and wait for its response;</div> <div>외부 서비스에 요청하고 응답에 대한 대기를 표현하기 위해서 packaged_task와 future를 사용하라</div> <div><br></div> <div>[24] Use async() to launch simple tasks;</div> <div>단순한 테스크를 시작하기 위해서 async()을 사용하라</div> <div><br></div> <div><br></div> <div><br></div> <div>14 History and Compatibility</div> <div><br></div> <div>[1] The material in this chapter roughly corresponds to what is described in much greater detail in Chapters 1 and 44 of [Stroustrup,2013].</div> <div>이 장에 있는 자료는 훨씬 더 자세한 설명이 있는 [Stroustrup,2013]의 1과 44장과 거의 일치한다.</div> <div><br></div> <div>[2] The ISO C++ standard [C++,2011] defines C++.</div> <div>ISO C++ 표준  [C++,2011]은 C++을 정의한다.</div> <div><br></div> <div>[3] When learning C++, don't focus on language features in isolation.</div> <div>C++을 배울 때, 고립적으로 언어의 기능에 촛점을 맞추지 말아라</div> <div><br></div> <div>[4] </div> <div>    [1] Use constructors to establish invariants.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>불변성을 설립하기위해서 생성자를 사용하라</div> <div><br></div> <div>    [2] Use constructor/destructor pairs to simplify resource management (RAII;).</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>자원 관리를 단순화하기 위해서 생성자/소멸자 쌍을 사용하라</div> <div>    </div> <div>    [3] Avoid "naked" new and delete.</div> <div>    무방비의 new와 delete 를 피하라</div> <div>    </div> <div>    [4] Use containers and algorithms rather than built-in arrays and ad hoc code (Chapter 9, Chapter 10).</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>기본형 배열과 특별 코드 대신 컨테이너와 알고리즘을 사용하라</div> <div>    </div> <div>    [5] Prefer standard-library facilities to locally developed code.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>지역적으로 개발된 코드 보다 표준 라이브러리 기능들을 선호하라</div> <div>    </div> <div>    [6] Use exceptions, rather than error codes, to report errors that cannot be handled locally.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>지역적으로 관리가 될 수 없는 에러를 표현하기 위해서 에러 코드 보다, 예외를 사용하라.</div> <div>    </div> <div>    [7] Use move semantics to avoid copying large objects.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>거대아 객체의 복사를 피하기 위해서 이동 의미 구조를 사용하라</div> <div>    </div> <div>    [8] Use unique_ptr to reference objects of polymorphic type.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>다형적인 타입의 객체를 참조하기 위해서 unique_ptr을 사용하라</div> <div>    </div> <div>    [9] Use shared_ptr to reference shared objects, that is, objects without a single owner that is responsible for their destruction.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>공유된 객체, 즉, 소멸에 대한 책임이 있는 단일 소유자가 없는 객체 를 참조하기 위해서 shared_ptr를 사용하라</div> <div>    </div> <div>    [10] Use templates to maintain static type safety (eliminate casts) and avoid unnecessary use of class hierarchies.</div> <div><span class="Apple-tab-span" style="white-space:pre;"> </span>정적 타입 안정성을 유지하기 위해서 템플릿을 사용하고, 불필요한 계층 클래스의 사용을 피하라</div> <div><br></div> <div>[5] Before using a new feature in production code, try it out by writing small programs to test the standards conformance and performance of the implementations you plan to use.</div> <div>제품 코드에서 새로운 기능을 사용하기 전에, 표준 적합성과 사용하고자 했던 구현들의 성능을 시험하기 위한 작은 프로그램을 작성해서 시험해 봐라.</div> <div><br></div> <div>[6] For learning C++, use the most up-to-date and complete implementation of Standard C++ that you can get access to.</div> <div>C++을 배우기 위해서, 구할 수 있는 것 중에서 가장 최신이면서 표준 C++의 구현이 가장 완전한 것을 사용하라.</div> <div><br></div> <div>[7] The common subset of C and C++ is not the best initial subset of C++ to learn;</div> <div>C와 C++의 공통 부분 집합은 가장 먼저 C++을 배우기 위한 집합은 아니다.</div> <div><br></div> <div>[8] Prefer named casts, such as static_cast over C-style casts;</div> <div>C-스타일 캐스잉보다 static_cast와 같은 명명된 캐스팅을 선호하라</div> <div><br></div> <div>[9] When converting a C program to C++, first make sure that function declarations (prototypes) and standard headers are used consistently;</div> <div>C프로그램을 C++로 변환 할 때, 첫번째로 함수의 선언(프로토타입)과 표준 헤더는 일관성 있게 사용되는지 확실히 하라</div> <div><br></div> <div>[10] When converting a C program to C++, rename variables that are C++ keywords;</div> <div>C프로그램을 C++로 변환 할 때, C++ 키워드들은 새이름으로 변경하라.</div> <div><br></div> <div>[11] For portability and type safety, if you must use C, write in the common subset of C and C++;</div> <div>호환성과 안전성을 위해서, 만약 C를 사용해야 한다면, C와 C++의 공통 집합 안에서 작성하라</div> <div><br></div> <div>[12] When converting a C program to C++, cast the result of malloc() to the proper type or change all uses of malloc() to uses of new;</div> <div>C프로그램을 C++로 변환 할 때, 적절한 타입으로 malloc()의 결과를 캐스팅하고나 모든 malloc()의 사용을 new 사용으로 변경하라.</div> <div><br></div> <div>[13] When converting from malloc() and free() to new and delete, consider using vector, push_back(), and reserve() instead of realloc();</div> <div>malloc()과 free()를 new와 delete로 변환할 때, 벡터, push_back(), 그리고 realloc() 대신 reserve() 사용을 고려하라.</div> <div><br></div> <div>[14] In C++, there are no implicit conversions from ints to enumerations; use explicit type conversion where necessary.</div> <div>C++에서 int에서 열거형으로 암시적인 변환은 없다; 필요한 곳에서 명시적 타입 변환을 사용하라.</div> <div><br></div> <div>[15] Use <string> to get std::string (<string.h> holds the C-style string functions).</div> <div>std::string을 얻기위해서<string>을 사용하라 (<string.h>은 C-스타일 문자열 함수를 가지고 있다.)</div> <div><br></div> <div>[16] For each standard C header <X.h> that places names in the global namespace, the header <cX> places the names in namespace std.</div> <div>전역 공간에 이름을 둔 표준 C 헤더 <X.h>에 대해서 헤더 <cX>는 이름들을 std 이름 공간 안에 둔다.</div> <div><br></div> <div>[17] Use extern "C" when declaring C functions;</div> <div>C 함수를 선언할 때 extern "C" 을 사용하라</div> <div><br></div> <div>[18] Prefer string over C-style strings (direct manipulation of zero-terminated arrays of char).</div> <div>C-스타일 문자열(0으로 끝나는 char형 배열의 직접적인 조작)보다 (std::) string을 선호하라</div> <div><br></div> <div>[19] Prefer iostreams over stdio.</div> <div>stdio보다 iostream을 사용하라</div> <div><br></div> <div>[20] Prefer containers (e.g., vector) over built-in arrays.</div> <div>기본 자료형 배열보다 container를 사용하라</div>

    이 게시물을 추천한 분들의 목록입니다.
    [1] 2016/02/21 10:28:05  61.84.***.32  밤나무꽃향기  136610
    [2] 2016/02/21 10:30:44  58.140.***.63  THIS만핀다  337566
    [3] 2016/02/21 10:55:50  211.202.***.172  의문의문의  653921
    [4] 2016/02/21 11:17:17  59.13.***.130  오렌지쥬스P  601374
    [5] 2016/02/21 11:58:39  14.138.***.39  슝슝3  284767
    [6] 2016/02/21 12:24:32  125.133.***.16  Hello,World!  138634
    [7] 2016/02/21 16:19:04  182.211.***.111  cobain  273427
    [8] 2016/02/21 17:55:37  222.239.***.225  용밤스  374904
    [9] 2016/02/21 19:53:12  175.126.***.146  Mac  520742
    [10] 2016/02/22 11:07:19  210.180.***.19  사닥호  425608
    푸르딩딩:추천수 3이상 댓글은 배경색이 바뀝니다.
    (단,비공감수가 추천수의 1/3 초과시 해당없음)

    죄송합니다. 댓글 작성은 회원만 가능합니다.

    번호 제 목 이름 날짜 조회 추천
    그랜드슬램 인증서/메달 받았습니다. [5] 황금비 17/10/14 08:30 1055 15
    강제 시즌 아웃, 다들 안라하세요. [18] 창작글 황금비 17/10/04 17:51 1842 27
    충주 다녀왔습니다. [10] 창작글 황금비 17/09/12 17:21 981 13
    대청댐, 이화령 다녀왔습니다. [7] 창작글 황금비 17/09/04 00:55 923 12
    연천 재인폭포 여행. 그리고 인증센터 [15] 창작글 황금비 17/08/20 02:59 1591 17
    비둘기낭폭포 다녀왔습니다. [4] 창작글 황금비 17/08/18 10:38 860 10
    강화도-석모도 다녀왔습니다. [4] 황금비 17/07/16 22:24 1179 17
    [스압] 제주도 1100고지, 환상자전거길, 한라산 다녀왔습니다. [16] 창작글 황금비 17/07/09 14:52 886 21
    지난주 금강/영산강 이번주 오천/새재/북한강 종주 끝냈습니다.[사진많음] [4] 창작글 황금비 17/06/27 11:37 874 12
    섬진강 다녀왔습니다. [9] 창작글 황금비 17/06/12 09:07 799 15
    2박3일 낙동강, 영덕,울진 다녀왔습니다. [9] 창작글 황금비 17/06/07 10:22 1296 16
    동해안(통일전망대-임원) 다녀왔습니다. [5] 창작글 황금비 17/05/29 15:11 899 12
    [후기/스압주의] 연휴 1270km 전국의 반 반국일주 했습니다. [8] 창작글 황금비 17/05/09 18:28 1242 23
    저 시즌 시작했습니다. [3] 창작글 황금비 17/03/19 01:38 1071 12
    로드 구입했습니다. [6] 창작글 황금비 17/01/15 11:09 2116 15
    게임 업계 아재가 게임 프로그램 배우는 분들에게 해주는 도움 안되는 글 [29] 창작글 황금비 16/05/02 12:39 4436 58
    A Tour of C++ 발 번역 [3] 창작글 황금비 16/02/22 11:07 2691 45
    러블리즈 가입했습니다. [5] 창작글 황금비 16/02/21 20:22 1035 14
    [1]
    단축키 운영진에게 바란다(삭제요청/제안) 운영게 게시판신청 자료창고 보류 개인정보취급방침 청소년보호정책 모바일홈