cpp_specialization - 8BitsCoding/RobotMentor GitHub Wiki
์ฌ์ค ๊ทธ๋ฆฌ ๋ง์ด ์ฐ์ด์ง๋ ์๋๋ค. ์์๋๋ ์ ๋?
- ํน์ ํ ํ ํ๋ฆฟ ๋งค๊ฐ๋ณ์๋ฅผ ๋ฐ๋๋ก ํ ํ๋ฆฟ ์ฝ๋๋ฅผ ์ปค์คํฐ๋ง์ด์ฆํ ์ ์์
template <class T, class Allocator>
class std::vector<T, Allocator> {} // ๋ชจ๋ ํ์ ๋ฐ๋ ์ ๋ค๋ฆญ vector
template <class Allocator>
class std::vector<bool, Allocator> {} // bool ํ์ ๋ฐ๋ ํน์ํ vector
// boolํ์ด ๋ค์ด์ค๋ฉด ์ฌ๊ธฐ๋ก ๋ค์ด๊ฐ๋ผ!
-
std::vector<bool>
ํน์ํ๋ ๊ฐ์น๊ฐ ์ข ์์- ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ชผ๋ค๋ฆฌ๋ ํ๋ซํผ์ด๋ผ๋ฉด?
- ์ ์ฒด ํ ํ๋ฆฟ ํน์ํ
template<typename VAL, typename EXP>
VAL Power(const VAL value, EXP exponent) {} // ๋ชจ๋ ํ์ ๋ฐ์
template<>
float Power(flaot value, float exp) // float์ ๋ฐ๋๋ก ํน์ํ
- ๋ถ๋ถ ํ ํ๋ฆฟ ํน์ํ
template<class Allocator>
class std::vector<bool, Allocator>