| aclark17 (16) | |
|
Why wont this compile template <class t> struct a { a(t& ty=t() ,a* p=0):o(ty),n(p){} t& o; a* n; }; | |
|
|
|
| firedraco (5414) | |
| What are the errors? | |
|
|
|
| Vlykarye (227) | |
|
Correction: It WILL compile. If it doesn't compile for you, then you must be getting errors somewhere, and I doubt it is with this piece of code (unless your compiler is out of date). | |
|
|
|
| Peter87 (3691) | |
| A temporary object can't bind to a non-const reference. | |
|
Last edited on
|
|
| Vlykarye (227) | |
| It works in Visual Studio. | |
|
|
|
| cire (1851) | ||||
If your definition of "works" is "the compiler doesn't complain if I don't instantiate an instance," then yes, it "works."
| ||||
|
|
||||