Boost logo

Boost :

From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-06-08 19:35:28


Hervé suggested:
>> std::pair<void *>

Phil replied:
>I was hoping using interval<void *> to trace what block of memory the
>construction of an object is being made on but it can easily be used to
>unify a block of memory with a pool or memory segment for example.

I agree with Hervé, I wouldn't have thought to use numeric::interval for your use case because I wouldn't expect you are using enough of what that library provides to justify the dependency. std::pair<void *> and a predicate contains(pair1, pair2) would be fine. You could even store your std::pair<void *> in a std::set and look up which block a given std::pair<void *> was contained in quite conveniently using std::set::lower_bound and the less than operator of std::pair as the comparator on std::set. Similarly, I wouldn't suggest that you use my gtl interval concept with a gtl::interval_data<void *> either because I don't think the benefit you might get out weighs the cost of a dependency.

Luke


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk