Friday, February 7, 2003

New Seminars: Patterns & PBD; C++ in Embedded Systems

I've recently developed two new C++ seminars and added descriptions of them
to my web site. Currently, they are available only for on-site
presentations, though it would not surprise me if I end up presenting one
or both at open-enrollment seminars in Germany in September.

Here are brief descriptions. Please consult their respective web pages for

PATTERNS AND POLICY-BASED DESIGN. I've been getting a lot of inquiries
about design patterns recently, but it seems that few people know that
C++ is uniquely capable of generating flexible and efficient pattern
implementations. This seminar is my way of covering the patterns
material people want to know along with the C++ design techniques they
need to know in order to really exploit patterns in C++. As far as I
know, there's no other course like this, and I'm very excited about it.
I taught it for the first time last week, and it was a big hit.
Full Description:

arrival of this seminar in a mailing last September, and I'm pleased to
say that it's now fully here. I'm even more pleased to report that the
embedded programmers who've attended the seminar have found the material
to be well suited to the concerns they confront. Short on bytes, cycles,
or a conforming C++ compiler, yet still want to take advantage of C++'s
modeling power, flexibility, efficiency or availability of outside tools?
Ask me how!
Full Description:

I also have a bunch of new talks I need to add to my Short Courses page
( When I get them
added, I'll let you know.


Tuesday, February 4, 2003

Impending Effective STL Errata List Update

Later today, I'll update the online errata list for Effective STL. As a
mailing list exclusive, here are the changes I'll be making. By the time
these make it to the web site, they may have been massaged somewhat, but
this is what I'll be working from.

Please note in particular the entry for page 91, because it seems to have
been confusing a lot of people recently.



-------- --- ----- ------------------------------------------------ --------
11/29/02 gm 44 Regarding the paragraph after the first code
example, the call to erase can't take
logarithmic time in general, because a multi
container might consist entirely of elements
with the value to be removed. gm notes that
"The correct statement, guaranteed true by the
Standard, is: it takes time O(log(n)+k) where n
is the size of the container and k is the number
of items to be erased."

9/ 4/02 ga 46 In the for loop in the first code example,
"AssocContainer" should be entirely in italics.

11/ 6/02 wb 57 In the second code example, the
SpecificHeapAllocator template is missing the
word "class" at the beginning of the template

7/13/02 ckl 91 In first code example, ssp's type should be
declared to be set.

1/12/03 as 108 Regarding the second-to-last paragraph on the
page, as points out that "only the assigment
operator is 'unnecessary', a temporary Widget is
going to be constructed anyhow, so you have in
balance a (useless) construction/destruction
plus an assigment OVER a (useful)

9/ 4/02 ga 141 At end of second prose paragraph, " should
probably be calling partition..." ==> "
should probably be calling partition or

9/25/02 pn 171-172 Some examples here fail to explicitly state that
inheritance from e.g., std::binary_function is
public. This is inconsistent with what I do
elsewhere in the book, e.g., on pp. 178-179. I
should check all the examples to make sure I'm

11/ 2/02 cb 253 In column 1, the entry for istream_iterators
mentioning operator<< should mention operator>>.

11/ 2/02 cb 255 In column 2, the entry for operator<< should
mention operator>>.

Interesting Comments:

-------- --- ----- -----------------------------------------------------------
7/15/01 sdm Item 1 For another discussion of the pros and cons of different
containers, check out Andrew Koenig's and Barbara Moo's
column, "Which Container Should I Use?," in the August 2001
C/C++ Users Journal

8/26/02 sdm Item 7 Several people have written to ask about why
DeleteObject::operator() takes a pointer to const, even
thought it's going to delete the pointer. The answer is
that if I did not, it wouldn't be possible to use
DeleteObject on containers such as vector.
There has been much debate in the C++ community over
whether deleting pointers-to-const should be legal, but it
is and it can be useful, so it's important to me that
DeleteObject support it.

8/18/02 apl 69 apl argues that credit for notion that "God is in the
details" should go to Mies Van Der Rohe, not Einstein. He
points to href=""
target="_blank">a column in The Atlantic online
to bolser his

9/ 4/02 ga 117 Five lines from the bottom, "const" should be
capitalized, because it is the first word in a sentence.

8/27/02 jcj Item 28 When using the range form of erase, there is no need to
adjust a reverse_iterator's base if it marks the end of the
erase range. Consider:

vector v;
... // Put 1-5 in v

// Remove 2-4 from vector in example [1, 2, 3, 4, 5]
vector::iterator ifirst = // ifirst points
find(v.begin(), v.end(), 2); // to the 2
vector::reverse_iterator rilast = // rilast points
find(v.rbegin(), v.rend(), 4); // to the 4
v.erase(ifirst, rilast.base()); // erase 2-4,
// inclusive

9/ 4/02 ga 133 Writes ga, "Another variation: reserve, move away/copy the
elements that would be moved one by one in one chunk and
then transform on the gap that we are left with." I
believe that in some cases, this will be more efficient
than resize/copy.

9/ 4/02 ga 161 for_each is also faster.

I'm also going to update some of the "Interesting comments" about Item 37,
but those updates are not shown here, sorry.