Boost logo

Boost :

Subject: Re: [boost] [graph] porting code from 1.46 to 1.54
From: Mikael Persson (mikael.s.persson_at_[hidden])
Date: 2013-10-07 22:06:03


Hi Maurizio,

On Mon, Oct 7, 2013 at 7:04 PM, Maurizio Vitale <mrz.vtl_at_[hidden]> wrote:

> In some dark corner of it, the following was compiling fine:
>
> struct InstancePropertyTag {
> typedef boost::vertex_property_tag kind;
> };
>
>
under 1.54, I get 'attempt to form reference to void', but everything was
> fine under 1.46.
>
> Does somebody know if some properties were added by default to graphs
> before and need to be explicitly added now?
>

The internal details of the property implementation have changed quite a
bit between version 1.46 and 1.54. I got taken by a similar problem some
time ago, and I learned my lesson: Do not rely on the internal details. If
things are not documented (i.e., part of the well-defined interface), then
you should not rely on it or expect it to remain the same.

If you look at the current definition of the BOOST_INSTALL_PROPERTY macro,
you see this:

#define BOOST_INSTALL_PROPERTY(KIND, NAME) \
template <> struct property_kind<KIND##_##NAME##_t> { \
 typedef KIND##_property_tag type; \
}

Meaning that you're property-tag should be defined as a partial
specialization of the property_kind template. It used to be that the "kind"
of the tag was obtained through a straight-forward traits mechanism that
just fetched the "kind" nested type within your property-tag class. Now,
they added a few layers to that to accommodate "special" tags like
"vertex_all_t" or "vertex_bundled_t". The way you defined your custom
property-tag may have worked in the old system, but apparently it does not
work anymore.

The documentation tells you that you should just use the
BOOST_DEF_PROPERTY macro
for defining new property-tags. That's what you should do. Trying to use
the internals directly is not a good idea for portability, because the
library implementers cannot be expected to maintain the internals, only the
user-facing functionality.

So, you should do:

namespace boost {
BOOST_DEF_PROPERTY(vertex, instance_property)
};

typedef boost::vertex_instance_property_t InstancePropertyTag;

I hope this solves your problem,

Sven Mikael Persson


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