Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
C++ Template
//clang 3.8.0 #include <iostream> using namespace std; template<typename T> class Container { private: T elt; public: Container(const T arg) : elt(arg) {} T inc() {return elt+1;} }; template <> class Container<char> { private: char elt; public: Container(const char arg) : elt(arg) {} char uppercase() {return toupper(elt);} }; int main() { Container<int> icont(5); Container<char> ccont('r'); cout << icont.inc() <<endl; cout << ccont.uppercase() <<endl; return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Argument passing by using reference and value
insertion sort
Dash-D compiler flag example
Assignment Operator Example
Combination
std::function ambiguity clang
Set sub sequences.
Rounding float to nearest 1000
Division by zero exception example
boost tokenizer
Please log in to post a comment.