|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2006-01-23 23:14:50
It might have something to do with operations on temporaries in parentheses?
Whatever heres more context to my other example example . Note if you want to
try this out in pqs
_3_0_4 you need to add boost::pqs:: in front of t1_quantity at line 143
In <boost/pqs/t1_quantity/operations/add_subtract.hpp>. Thats an error in
pqs_3_0_4 but only affects VC8
Then in the same file disable the conditonal defines for vc8 around namespace
open and close parentheses for operator + and operator - .
Maybe this will work on simpler udts in the same sort of situation. Will try
this
next.
#include <boost/pqs/t1_quantity/types/out/velocity.hpp>
#include <boost/pqs/t1_quantity/types/out/acceleration.hpp>
#include <boost/pqs/t1_quantity/types/out/time.hpp>
// Note all operators except addition/subtraction
// are defined in global namespace for this test
// #define FUNC1 only --> compiles OK
// #define FUNC1 and FUNC2 --> compiles OK
// #define FUNC2 --> error no '-' operator found
#define FUNC1
#define FUNC2
#ifdef FUNC1
boost::pqs::acceleration::m_div_s2
Func1(
const boost::pqs::velocity::mm_div_s& a,
const boost::pqs::velocity::m_div_s& b,
const boost::pqs::time::s & t
)
{
// succeeds not affected by parentheses;
boost::pqs::velocity::m_div_s v = (a - b);
// succeeds
//boost::pqs::velocity::m_div_s v = a - b;
boost::pqs::acceleration::m_div_s2 result = v / t;
return result;
}
#endif
#ifdef FUNC2
boost::pqs::acceleration::m_div_s2
Func(
const boost::pqs::velocity::mm_div_s & a,
const boost::pqs::velocity::m_div_s& b,
const boost::pqs::time::s & t
)
{
// fails
boost::pqs::acceleration::m_div_s2 result = (a-b) / t;
// fails
// boost::pqs::acceleration::m_div_s2 result = 1 / (t / (a-b));
// succeeds
//boost::pqs::acceleration::m_div_s2 result = (boost::pqs::operator-(a, b)) /
t;
// succeeds
//boost::pqs::acceleration::m_div_s2 result = a / t - b/ t;
return result;
}
#endif
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk