Boost logo

Boost Users :

Subject: [Boost-users] Declaring tricky templated variables such as disjoint_sets.
From: Jeremy Murphy (jeremy.william.murphy_at_[hidden])
Date: 2013-06-22 11:44:39


Hi,

this is a somewhat general C++ question, but I'm specifically concerned
about a Boost class in this case.

How do I declare a boost::disjoint_sets<Rank, Parent, FindCompress>
variable without some kind of automatic template deduction? Usually I see
such classes declared taking their template parameters from within a
function such as:

template <typename Rank, typename Parent>
void foo(Rank rank, Parent parent)
{
    disjoint_sets<Rank, Parent> dset;
}

but what if I want to declare dset at file scope? I've been trying to
manually construct the Rank and Parent types, but it's slightly doing my
head in and the iterator_property_map example seems to be stale.

Is there a general C++ technique or a Boost-specific one that can help me
out here? Or is it just a matter of laboriously building up the typedefs?
 Thanks, cheers.

Jeremy



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