Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2006-07-15 15:55:49

On 7/15/06, David Abrahams <dave_at_[hidden]> wrote:
> "Dean Michael Berris" <mikhailberis_at_[hidden]> writes:
> >
> > This is called strategized index validation, and strategized routing
> > implementation -- both being concepts that will need much
> > documentation. This is documented in the
> > section in the included documentation.
> There's too much coupling of unrelated concepts in this design, it
> seems to me. All that's required to do this is a generic wrapper over
> string:

Now that you've mentioned it, I have to agree with you with that
point. It seems that the routing and validation are useful concepts in
themselves especially in many different contexts involving runtime
input and input manipulation -- especially useful when dealing with
generic associative containers.

> template <class T, class Validate, class Hash>
> struct strategized_index
> {
> // Throws an exception unless Validate()(x). Stores x as a member
> strategized_index(T const& x);
> // returns Hash()(*this.x) < Hash()(rhs)
> bool operator<(strategized_index const& rhs);
> };
> If you really need comparison and hashing to be stateful, then you do
> need to parameterize the container... but you still don't need to tie
> it to dispatching; just choose to store boost::function objects as
> Kevin suggested:
> template <class K, class V, class Validate, class Hash>
> struct strategized_unordered_map;
> no?

Yes, that makes a lot of sense. Perhaps separating the index and
router concepts as parameters to a generic container (much like a map,
which maps objects to keys) which the dispatcher itself just uses,
then they can be useful components in themselves.

Thank you very much for the insights. :) I would most probably take
this path and explore it further.

Have a great weekend everyone!

Dean Michael C. Berris
C/C++ Software Architect
Orange and Bronze Software Labs
Mobile: +639287291459
Email: dean [at] orangeandbronze [dot] com

Boost list run by bdawes at, gregod at, cpdaniel at, john at