$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Peter (p.schregle_at_[hidden])
Date: 2008-04-25 04:41:49
Assuming I have a class like the following:
template <typename T>
struct point : boost::additive<point<T>, T>
{
    T x_;
    T y_;
    explicit point(T x=0, T y=0) : x_(x), y_(y)
    { }
    operator += (T offset)
    {
        x_ += offset;
        y_ += offset;
    }
    operator -= (T offset)
    {
        x_ -= offset;
        y_ -= offset;
    }
}
Now I want to change the addition and subtraction operators to allow for 
different types using the following template
class point ...
    template <typename U>
    operator += (U offset)
    {
        x_ += offset;
        y_ += offset;
    }
    template <typename U>
    operator -= (T offset)
    {
        x_ -= offset;
        y_ -= offset;
    }
...
I cannot figure out how to write the proper syntax for the boost::additive 
class, so that it generates the proper additional operators for all type 
combinations. Is that possible, at all?
Thanks, Peter