Boost logo

Boost Users :

Subject: Re: [Boost-users] boost:any/boost::variant for integral/floating type
From: Mathieu Malaterre (mathieu.malaterre_at_[hidden])
Date: 2010-06-03 05:22:10


On Tue, Jun 1, 2010 at 3:31 PM, Igor R <boost.lists_at_[hidden]> wrote:
>>  struct get_min_visitor
>>    : public boost::static_visitor<>
>>    {
>>    template <typename T>
>>      T operator()(T & i) const
>>        {
>>        return std::numeric_limits<T>::min();
>>        }
>>    };
>
>
> You have to pass the result type as an argument to static_visitor
> template. Maybe you meant something like this:
>
>  //...
>  AttributeValue(int i) : Value(i)
>  {}
>  AttributeValue(double d) : Value(d)
>  {}
>  // etc...
>
>  struct get_min_visitor : public boost::static_visitor<AttributeValue>
>  {
>   template <typename T>
>   AttributeValue operator()(const T &) const
>   {
>     return std::numeric_limits<T>::min();
>   }
>  };

Thanks, I could even get it working with:

template <typename T>
  AttributeValue(T t) : Value(t)
  {}

Thanks

-- 
Mathieu

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