This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [libstdc++] New implementation of concept checking


Toon Moene <toon@moene.indiv.nluug.nl> writes:

| Phil Edwards wrote:
| 
| >    [To those of you in the studio audience who are wondering "what the
| >     heck is Boost and what makes their code any good?" I can only say
| 
| Surprisingly, that's _not_ the question that came to my mind.  Rather:
| What's concept checking ? [ I guess it's something that comes before
| implementation checking .... ]

The whole story goes back to how to make diagnostics messages
involving templates /understandable/.  Or how to ensure that a
template-argument has the required semantics for a successful class or
function template instantiation.  Try this

	#include <vector>

	int main()
	{
		std::vector<int> v(9.0, 3.14);		
	}

to see what I mean.

The idea of concept checking is to express those constraints in form of
expressions/declarations which, given their spellings, should give
hints about the constraints assumed on the behalf of the template
arguments in case, some violations are detected.  Those expressions
are expected not to incure runtime overhead, in theory.

That feature already exists in Standard ML in form of signatures.  C++
just forgot to include them :-)

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]