Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7378: lookup_one_property fails if property tag not found
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-14 17:55:51
#7378: lookup_one_property fails if property tag not found
-----------------------------------------------+----------------------------
Reporter: Andreas Hehn <hehn@â¦> | Owner: dgregor
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: graph
Version: Boost 1.52.0 | Severity: Problem
Resolution: wontfix | Keywords: lookup_one_property property_value
-----------------------------------------------+----------------------------
Comment (by Andreas Hehn <hehn@â¦>):
The problem is that in the enable_if of the lookup(...) member function
{{{
template <typename Tag, typename T, typename Base, typename PropName>
struct lookup_one_property_internal<boost::property<Tag, T, Base>,
PropName>: lookup_one_property_internal<Base, PropName> {
private:
typedef lookup_one_property_internal<Base, PropName> base_type;
public:
template <typename PL>
static typename enable_if<is_same<PL, boost::property<Tag, T, Base> >,
typename base_type::type&>::type
lookup(PL& prop, const PropName& tag)
}}}
typename base_type::type& does not depend on the template parameter of the
template member function but only on the template parameters of the class.
Therefore base_type::type is required to exist, even if lookup(...) is not
used (or the enable_if<...> disables the function).
A solution could be to add a indirection which depeneds on {{{PL}}}, like
{{{
template <class First, class Second>
struct second_type {
typedef Second type;
};
...
static typename enable_if<is_same<PL, boost::property<Tag, T, Base> >,
typename second_type<PL,base_type>::type::type&>::type
lookup(PL& prop, const PropName& tag)
}}}
which will prevent the compiler from resolving base_type::type unless
lookup(...) is explicitly instantiated.
This way the general template {{{lookup_one_property_internal}}} does not
need to define a {{{type}}} member to use
{{{lookup_one_property<...>::found}}}.
But I have to admit that this solution looks a little ugly.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7378#comment:7> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC