Boost logo

Boost Users :

From: Raymond Haeb (ray.haeb_at_[hidden])
Date: 2008-04-08 20:02:05


Hello,

namespace bi = boost::intrusive;
typedef bi::set<relation, bi::constant_time_size<false> > set_type;
set_type set;

class relation:
        private boost::noncopyable,
        public bi::set_base_hook<optimize_size<true> >
{
public:
        boost::uuid const &get_uuid() const { return uuid_; }
        void change_uuid( boost::uuid const& uuid )
        {
                unlink();
                uuid_ = uuid;
                // TODO: reinsert it with the new uuid,
                // or leave it linked and find a way to tell the set,
                // that the value has been changed and the tree is // invalid

        }
        struct uuid_cmp
        {
                bool operator()( boost::uuid const &id, relation const &rel ) const {
return id < rel.get_uuid(); }
                bool operator()( relation const &rel, boost::uuid const &id ) const {
return rel.get_uuid() < id; }
        };
        bool operator<( relation const &a ) const { return uuid_ < a.uuid_; }

private:
        boost::uuid uuid_;
}

So the question is in the comment: Is there a way to change the value of
an element of a set or insert an (new) element in a set, without having
a pointer to the set?

TIA,
Raymond


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net