STL - Standard Template Library
원래는 SGI 에서 C++ 지원용으로 개발된 템플릿이다.
[링크 : http://www.sgi.com/tech/stl/index.html]
Scott Meyers 가 작성한 Effective STL (200page)
[링크 : http://www.uml.org.cn/c++/pdf/EffectiveSTL.pdf]
Template는 c++ 에서 지원하는 기능으로
함수나 클래스등을 형(type)에 관계없이 작동시키는(generic type - 일반형) 것이라고 한다.
[링크 : http://en.wikipedia.org/wiki/C%2B%2B_Standard_Library]
[링크 : http://www.iis.sinica.edu.tw/~kathy/vcstl/templates.htm]
원래는 SGI 에서 C++ 지원용으로 개발된 템플릿이다.
[링크 : http://www.sgi.com/tech/stl/index.html]
Scott Meyers 가 작성한 Effective STL (200page)
[링크 : http://www.uml.org.cn/c++/pdf/EffectiveSTL.pdf]
Template는 c++ 에서 지원하는 기능으로
함수나 클래스등을 형(type)에 관계없이 작동시키는(generic type - 일반형) 것이라고 한다.
#include <iostream>
template <typename T>
const T& max(const T& x, const T& y)
{
if(y < x)
return x;
return y;
}
int main()
{
// This will call max <int> (by argument deduction)
std::cout << max(3, 7) << std::endl;
// This will call max<double> (by argument deduction)
std::cout << max(3.0, 7.0) << std::endl;
// This type is ambiguous; explicitly instantiate max<double>
std::cout << max<double>(3, 7.0) << std::endl;
return 0;
}[링크 : http://en.wikipedia.org/wiki/Template_%28programming%29] |
[링크 : http://en.wikipedia.org/wiki/C%2B%2B_Standard_Library]
[링크 : http://www.iis.sinica.edu.tw/~kathy/vcstl/templates.htm]
'Programming > C++ STL' 카테고리의 다른 글
| C++ 레퍼런스 변수(reference variable) (4) | 2010.09.15 |
|---|---|
| C++0x (0) | 2010.09.15 |
| std::vector 포인터 (0) | 2010.09.13 |
| 스마트 포인터(smart pointer) (2) | 2010.09.09 |
| C++ 강좌/문법/reference (4) | 2010.09.09 |
