Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "string"
- #include "iostream"
- template<typename T>
- void Print()
- {
- static_assert(false, "Nieobsługiwany typ");
- }
- template<>
- void Print<int>()
- {
- std::cout << sizeof(int)<< std::endl;
- }
- template<>
- void Print<float>()
- {
- std::cout << sizeof(float) << std::endl;
- }
- int main()
- {
- Print<int>();
- Print<float>();
- //Print<std::string>(); //----> błąd "Nieobsługiwany typ" podczas kompilacji
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement