Pizer’s Weblog

programming, DSP, math

Posts Tagged ‘concepts

C++0x: No concepts no fun?

with 6 comments

“Concepts” was a proposed C++0x feature that was supposed to make generic programming more enjoyable. The intention was to render many guru-level “template tricks” superfluous, produce much better compile-time error messages and provide “modular type checking” so errors can be caught early (even before a template is instantiated).

  • Fact 1: Concepts have been removed from the C++0x standardization effort. See Doug Gregor’s blog post.
  • Fact 2: C++0x still includes a whole lot of other core language and library features.

Read the rest of this entry »

Written by pizer

August 16, 2009 at 6:29 pm

C++0x: concepts & rvalue references — 2nd round

with 4 comments

Last update: 2009-02-1

Concepts and rvalue references are two new features that are going to be included in the next official version of the C++ language with high probability. I’m not going to mention the basics behind those two features because it has been done before in other articles. Try this google video or this article for an introduction to concepts by Doug Gregor and this article for an introduction to rvalue references by Howard Hinnant et al.

I already wrote a post on concepts and rvalue references here which discussed some problems when concepts are combined with rvalue references. It turned out that David Abrahams and Doug Gregor were also aware of the first issue I addressed. They published an article one day before I wrote about it. In this post I’m going to address other arguments (consistency and intuitivity) for why I think their proposed resolution is a good idea and what other language modification can increase consistency. Before I go into the last bit I will shed some light on what function requirements actually mean and how they can be satisfied.

Update 2009-02-1:[ It turns out you can’t exprapolate the meaning of function requirements from the concept_map checking rules because they don’t cover all use cases in constrained contexts (see hole in concepts system). So, keep this in mind while reading the rest of this article.]

Read the rest of this entry »

Written by pizer

January 8, 2009 at 7:04 pm

C++0x: Interaction between rvalue references & concepts

with 2 comments

Last update: 2008-12-08

I noticed some unfortunate gotchas when using two of the upcoming C++ features together: Rvalue references and concepts/templates. One of these problems can actually be seen in the currend draft of the future C++ specification. As far as I can tell, it looks like a subtle but nasty bug. Check out chapter 23.2.6 [vector, page 826]:

Read the rest of this entry »

Written by pizer

December 6, 2008 at 6:44 pm