c++ magic or ?

Started by
13 comments, last by SiCrane 16 years ago
Have you been reading this?
Advertisement
Quote:Original post by Kelly G
Have you been reading this?


No, what I pasted was straight from one of the Boost examples. Boost is considered the C++ gold standard.

The solution to writing unmaintainable code and ensure a job for life is simply to use C++ ;)
Boost likes extending the language to see where it can go. :)

In that case, we have operator() returning an inserter object that accepts operator(), which returns itself (or another inserter object).

The += trick is new -- how did they do that?
You probably should return a Vec& from the *= operator to keep it consistent with the base types' counterparts.
Quote:Original post by NotAYakk
The += trick is new -- how did they do that?


boost::assign creates an overload for operator += with a vector on the left hand side that returns an object that has the comma operator overloaded. You can look at the actual header for the details.

This topic is closed to new replies.

Advertisement