Created
July 2, 2010 23:03
-
-
Save r2p2/462050 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ main.cpp -std=gnu++0x | |
#include <vector> | |
#include <memory> // shared_ptr | |
template <class T> | |
class Base | |
{ | |
public: | |
Base(T value) | |
:m_value(value) | |
{} | |
T value() | |
{ | |
return m_value; | |
} | |
void value(T new_value) | |
{ | |
m_value = new_value; | |
} | |
protected: | |
T m_value; | |
}; | |
class Integer : public Base<int> | |
{ | |
Integer(int new_value) | |
:Base<int>(new_value) | |
{} | |
}; | |
int main() { | |
std::vector<std::shared_ptr<Base<auto> > > list; | |
return list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment