LWN.net Logo

C++0x to save the day

C++0x to save the day

Posted Aug 7, 2009 19:50 UTC (Fri) by hummassa (subscriber, #307)
In reply to: C++0x to save the day by ncm
Parent article: Converting GCC to C++

> The compiler can't know, by itself, that a template argument must model a numeric type.

Sure it can. The compiler has access to the source of the template; it will have to generate code based on that source eventually, so it knows what it needs.

Even if the compiler does not "plan ahead", during the instantiation phase it can deduce WHY the instantiation went wrong, instead of spilling WHAT went wrong with it... and point to the right lines of code, and giving meaningful class names instead of "complete" class names (IOW:

std::string
instead of
std::basic_string<char, std::char_traits<char>, std::allocator<char>>

)...


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds