typedef
,typedef typename
의 차이
https://lecor.tistory.com/76
typedef typename iterator_traits<Iterator>::iterator_category iterator_category;
참고 한곳
https://cplusplus.com/
https://github.com/gcc-mirror/gcc/blob/54c1bf7801758caf2ff54917e79a8c239643061c/libstdc%2B%2B-v3/include/bits/stl_iterator.h
#include <cstddef>
<cstddef>와 <cstdlib>는 C++ 프로그램에서 종종 사용되는 C 호환 헤더 파일이다.
이것은 C헤더파일 <stddef.h>와 <stdlib.h>의 새로운 버전으로, 공통상수, 매크로, 타입, 함수들을 정의하고 있다.
<cstddef>의 정의
식별자 : 의미
NULL : '정의되지 않음‘이나 ’값이 없음‘을 의미하는 포인터 값 (근데 얘는 C++11 임)
size_t : 원소의 개수같이 음수가 될 수 없는 사이즈 단위
ptrdiff_t : 포인터의 차이를 위한 signed 타입
offsetof() : struct나 union에서 멤버의 오프셋
struct input_iterator_tag {};
struct outout_iterator_tag {};
struct forword_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forword_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
원형 과 인자들의 의미
첫번째 이미지에 있음 근데 다시 정리
/**
* Traits class defining properties of iterators. (T * sepcializtion)
**/
template <typename T>
struct iterator_traits<T *>
{
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef random_access_iterator_tag iterator_category;
};
/**
* Traits class defining properties of iterators. (const T * sepcializtion)
**/
template <typename T>
struct iterator_traits<const T *>
{
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef const T* pointer;
typedef const T& reference;
typedef random_access_iterator_tag iterator_category;
};
}
요건 algorithm.hpp 할때 다시 정리 .
distance