poy
poy

Reputation: 10507

Templates and headers

So do any of the future standards of c++ plan to resolve the issue of having to combine the declaration and implementation?

Upvotes: 3

Views: 145

Answers (2)

Mark Ransom
Mark Ransom

Reputation: 308206

There's a very good reason why the template implementation needs to go into the header. A template is not code - it's only a template for the automatic generation of code. The code doesn't get created until you try to use it with the template parameters filled in. The compiler needs to have the full template body in order to fill in the blanks and get working code.

Upvotes: 7

bdonlan
bdonlan

Reputation: 231163

C++0x does not. Other future standard versions haven't even begun being drafted yet.

Upvotes: 0

Related Questions