본문 바로가기

SW 지식

(19)
[C++] std::pair와 std::tuple [TBD] tuple의 사전적 정의 -tuple 접미사 앞에 숫자를 붙여 「한 벌의 것」의 뜻을 나타냄 e.g. a 3--tuple ...? 이해는 되지만, 다른 의미일 수도 있어서 찾아보았더니 Wikipedia에서 아래와 같은 정보를 찾았습니다. In mathematics, a tuple is a finite ordered list (sequence) of elements. An n-tuple is a sequence (or ordered list) of n elements, where n is a non-negative integer. ... In computer science, tuples come in many forms. Most typed functional programming languages imp..
[C++] emplace 함수 emplace의 사전적 정의 emplace 타동사 1. 설치하다 2. 관입하다 3. 발달하다 이처럼 emplace 함수는, C++11부터 들어간 함수로, push() 함수와 비슷한 기능을 합니다. ("Insert a new element") 지난 게시물에서 배운, std::unordered_map 뿐만 아니라, std::vector 에도 있는 함수였습니다! 이 페이지에선 unordered_map의 emplace() 함수로 설명 및 예시를 들어보겠습니다. Inserts a new element into the container constructed in-place with the given args if there is no element with the key in the container. Carefu..
[C++] unordered_map 컨테이너 unordered_map 은 C++ STL 중 하나로, map보다 더 빠른 탐색을 위해 성능이 개선된 자료구조입니다. Unordered maps are associative containers that store elements formed by the combination of a key value and a mapped value, and which allows for fast retrieval of individual elements based on their keys. Unordered map is an associative container that contains key-value pairs with unique keys. Search, insertion, and removal of eleme..
[C++] std::function 은 무엇일까 std::function은, Class template std::function is a general-purpose polymorphic function wrapper. Instances of std::function can store, copy, and invoke any CopyConstructible Callable target -- functions, lambda expressions, bind expressions, or other function objects, as well as pointers to member functions and pointers to data members. The stored callable object is called the target of std::func..
[C++] 람다 식 Lambda expressions lambda 의 사전적 정의 lambda 명사 1. 람다(Λ, λ): 그리스어 알파벳의 열한째 자모. (참고 - 영어에서는 L, l로 표기됨.) 2. [화학] 람다: 체적의 단위; =10⁻³cm³, 10⁻⁶liter. 3. [물리] 람다 입자(粒子)(lambda particle): hyperon의 하나. 4. [유전학] 람다 파지: 대장균의 유전자를 도입하고 다른 데로 전송 하는 능력을 가짐. 그렇다면, C++에서 나오는 lambda 식은 무엇일까? Lambda expressions (since C++11) Constructs a closure: an unnamed function object capable of capturing variables in scope. -> 범위 내에서 변수를 캡처할 수 있..
DALi (Dynamic Animation Library) DALi는 Dynamic Animation Library 의 약자로, 3D 그래픽 엔진입니다! 즉, 2D와 3D 렌더링을 좋은 성능으로 쉽게 개발할 수 있도록 지원하는 라이브러리입니다. 사실 화가 살바도르 달리에서 따온 것이기도 하겠지요 ;) DALi의 특징은, 저전력 디바이스들에도 안정적인 60 FPS (Frames Per Seconds)를 유지하며 부드러운 애니메이션을 보여줍니다! C++과 C#을 지원해서 쉽게 사용할 수도 있구요. 주로 Tizen platform에 집중하지만, cross platform도 지원합니다. Tizen mobile / Wearable / Galaxy S6 / Smart Fridge / Smart TV 등 다양한 삼성 디바이스에 적용되고 있습니다. 출처 : https://da..
[C++] mutable 변수 mutable의 사전적 정의 mutable 형용사 1.변덕스러운 2.변하기 쉬운 3.가변성의 그렇다면, C++에서 나오는 mutable 키워드는 무엇일까? mutable specifier mutable - permits modification of the class member declared mutable even if the containing object is declared const. 즉, 객체가 const로 선언된 경우에도 변경 가능하도록 허용한다는 것을 나타낼 때 사용! 예를 들어, struct MyInfo { int a; mutable int b; }; void main() { const MyInfo value = {5,8}; value.a = 4; // 에러 value.b = 7; } 이..
[C++] String의 substr substr : substring 을 줄인말인 것처럼 하위 문자열을 생성하여 리턴! string substr (size_t pos = 0, size_t len = npos) const; 문자열의 'pos'번째 문자부터 'len' 길이 만큼의 하위 문자열을 반환합니다. 예를 들어, 아래와 같이 str이라는 변수의 string이 주어졌을 때, substr()로 3번째 문자부터 길이 5만큼의 하위 문자열을 반환하고자 할 때 사용됩니다. #include #include int main () { std::string str="We think in generalities."; std::string str2 = str.substr (3,5); // "think" std::cout