N
Niels Lauritzen
CONSIDER:
#include <valarray>
class ivec : public valarray<int>
{
public:
ivec(size_t sz) : valarray<int>(sz){};
void t();
};
int main()
{
ivec w(1);
(-w).t();
}
The return type of -w above is valarray<int> and not the derived type ivec.
This results
in a COMPILATION ERROR.
Is there a neat way of reusing the unary -operator of valarray<int> above?
To make
a type conversion to ivec?
Regards,
Niels Lauritzen (e-mail address removed)
#include <valarray>
class ivec : public valarray<int>
{
public:
ivec(size_t sz) : valarray<int>(sz){};
void t();
};
int main()
{
ivec w(1);
(-w).t();
}
The return type of -w above is valarray<int> and not the derived type ivec.
This results
in a COMPILATION ERROR.
Is there a neat way of reusing the unary -operator of valarray<int> above?
To make
a type conversion to ivec?
Regards,
Niels Lauritzen (e-mail address removed)