|
Boost : |
From: Andy Glew (glew_at_[hidden])
Date: 1999-08-16 12:11:02
> You define pre++, pre-- and *, you get post++, post--, and ->.
>
> There is also the comparison utilities, which give you >, >=,
> <=, != with just == and <.
This is a good step, but not sufficient.
Correct me if I am wrong, but would I not need to code up every
access method that located a non-existing object?
E.g.
live< map< key, object* > > livemap;
livemap::find(key)
call map<key,object*>::find(key)
if it locates a nonexisting object, delete it, and
re-dispatch the original function
I think that this would be the pattern for all methods that return iterators:
call the method on the underlying data structure, and delete and redispatch
if non-existing. At least for containers with stable iterators.
Sure would be nice if there were some way to say this once and for all, as opposed
to having to replicate the code for it everywhere.
Hmmm.... that tickled a neuron. Sure enough, Stroustrup's D&EofC++ says that
his original C with Classes had call and return methods where such hooks could be
applied, and on page 268 he talks about how such method combination can be
acheived manually - unfortunately, requiring code replication.
So, since the feature is *not* in C++, maybe the right thing to do is to have an external
program write the code for me.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk