Boost logo

Boost Users :

Subject: Re: [Boost-users] boost:any/boost::variant for integral/floating type
From: Igor R (boost.lists_at_[hidden])
Date: 2010-06-01 09:31:49


>  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();
   }
 };


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