라벨이 Template Specialization인 게시물 표시

Implementing a function that accepts only the user defined types in using the template specialization of C++.

A foo() in below source code will be accepted only the two types like myString and String2, but other types will occur an errors on compile time.

C++ 템플릿 특수화(Template Specialization)을 이용하여 특정 타입만 허용하는 함수 구현

소스 코드에서 foo() 함수는 myString과 ccString2 타입만 허용하도록 하여, 다른 타입들이 들어오면 컴파일 오류를 발생하는 예제