728x90 반응형 Min2 [C++][header][algorithm] min max 『목차』 0. 설명에 앞서 1. Default Constructor 2. Custom Constructor 3. Initializer List Constructor 0. std::min & std::max 『설명에 앞서』 참고 1. ①비교할 값들이 많거나, ②ArrayㆍVector와 같은 일련의 컨테이너에 저장되어 있다면, 최소값ㆍ최대값을 구하기 위해 min_element 또는 max_element 함수를 사용할 수 있다. (해당 함수에 대해서는 나중에 포스팅 하겠다.) 2. std::min와 std::max는 algorithm 라이브러리에 3가지 형태로 존재한다. 『① Default Constructor 』 『② Custom Constructor 』 『③ Initializer List Construct.. 2023. 2. 22. [C][Macro] min max 『목차』 1. The old C macro way 2. The new improved gccㆍclang "statement expression" way 3. [C++] std::min() & std::max() 4. 출처 1. The old C macro way 매크로 원형 /* min */ #define min(a, b) (((a) (b)) ? (a) : (b)) 단점 : double-evaluation side effect 발생 /* Input */ #include #define min(a, b) (((a) (b)) ? .. 2023. 2. 21. 이전 1 다음 728x90 반응형