Tuesday, December 27, 2011

Christmas Typos



Page 17:

Y is a dependent name, since its meaning depends on X

Should be:

Y is a dependent name, since its meaning depends on T




Page 146:

copy_q<double [3], int&>::type err2; //error: test is an array of 'int&'

Should be:

copy_q<double [3], int&>::type err2; //error: type is an array of 'int&'

Sunday, December 18, 2011

A couple of typos


On page 464:

template <typename T, size_t N>     
struct array                        
{                                   
   scalar_t data[N];                
};

should be actually:

template <typename T, size_t N>     
struct array                        
{                                   
   T data[N];                       
};



On page 226, missing open bracket before begin:


for_each(v.begin), v.end(), my_functor());
               ^^                         

Sunday, December 11, 2011

Paragraph missing from section 3.2.3


Apparently nobody reported this issue yet.
Section 3.2.3 does not have a conclusion. You can download a small pdf with the correction


Monday, November 21, 2011

Typo ((

There's an extra/missing bracket on page 131. 


static const int value = ((X % 2) ? 0 : -1;
                         ^^                

Tuesday, November 1, 2011

Syntax error in section 2.4.11

For some reason (namely, abuse of find & replace...), in section 2.4.11 three cast operators are incorrect.


bool operator() const 
{                     

should be:

operator bool() const 
{                     


Monday, October 31, 2011

Table of contents

A couple of readers asked the table of contents.
Amazon does not display it, at the moment.

Sunday, October 30, 2011

selector is not an empty class


In paragraph 3.1.2 a selector is defined as an empty class, and later in 3.1.3 we observe that a selector is equivalent to a static_value<bool>, which in fact has a (static) member called value.
However, from that point on, selectors are used as if they contain:

static const bool value = ...; 

The first place where this is actually needed is in section 4.3.1 (otherwise static_OR would not contain a result).
You can replace the definition of selector so that it indeed derives from static_value, or just add the boolean:

template <bool B>
struct selector : static_value<bool, B>
{
};

Tuesday, October 25, 2011

catch (Errata&) { return new Material; }

Some time ago I promised to the readers who are writing me to collect their feedback into a website. A blog seems the appropriate place, since evolution comes from discussion.
Some posts will be fixes, some posts will be new ideas.

According to the C++ principle of minimal overhead, the number of posts will also be proportional to the number of visitors/followers.