|
Boost : |
From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2004-03-29 00:26:44
----- Original Message -----
From: "Tom Brinkman" <reportbase_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, March 29, 2004 6:25 AM
Subject: [boost] Index_set observations
> Comments:
> Again, congratulations on this library.
> I see it, combined with the serialization library , as
> having the potential to eliminate the need for
> relational databases in c++ applications.
What's wrong with relational databases?
> Granted, if
> the development staff consists of DBAs and Java
> developers they would not agree to such a thing.
> However, if you have an application that consists of
> just c++ code, you could make the argument that
> relational databases are no longer needed. That would
> be a great thing, as relational datbases and sql are
> not c++ friendly.
Here I agree. I hope that designs like indexed_set<> and RTL will lower the
impedance mismatch, too.
> I spent many years writing c++ applications that were
> simply wrappers over relational datbases designed by
> DBAs. I've always thought that there had to be a
> better way. It would appear that you have done just
> that with this library.
>
> Questions:
> 1) When you add a record to an indexed_set, and it
> violates the index definition in some way, could you
> throw an exception, instead of simply replacing the
> original record?
As far as I understand, insert() returns a std::pair<iterator, bool>. The
boolean indicates, if the insertion was successful. insert() doesn't replace
an existing record.
> 2) Is there support for mult-key unique indicies. I
> read in the documenation that you can have more than
> one unique indice in the definition, but they are
> unique individually. Question: Can you combine two or
> more of those unique indice to create a multi-key
> unique indice.
If you create an indexed_set of thingies
typedef is::indexed_set<
thingy,
is::index_list<
is::unique<is::tag<pk_tag>,
is::identity<const thingy>, pk_comparer>
>
> thingies;
where pk_comparer implements an specialized comparer based on lex_compare,
will do the job (see example/composite_compares.cpp for an example). Maybe
this construction could be simplified.
Best,
Joerg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk