Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
template <typename T> struct polymorphic : public T ???
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="verec, post: 2511566"] I'm not sure exactly what went wrong, but this first version was correct ... #include <iostream> #include <string> #include <queue> template <typename T> struct polymorphic : public T { virtual ~polymorphic() {} } ; void test_00001() { typedef polymorphic<std::queue<int> > IntQueue ; IntQueue queue ; queue.push(5) ; queue.push(6) ; queue.push(7) ; queue.push(8) ; while(!queue.empty()) { int i = queue.front() ; queue.pop() ; std::cout << "Just popped: " << i << std::endl ; } } Though I couldn't find a single example of use that particular syntax (which kind of turns templates inside out) it is accepted by gcc 4. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
template <typename T> struct polymorphic : public T ???
Top