|
Boost-Commit : |
From: eric_at_[hidden]
Date: 2008-01-03 19:41:45
Author: eric_niebler
Date: 2008-01-03 19:41:44 EST (Thu, 03 Jan 2008)
New Revision: 42449
URL: http://svn.boost.org/trac/boost/changeset/42449
Log:
don't deref NULL in typeof, to keep HP cxx happy
Text files modified:
trunk/boost/accumulators/numeric/functional.hpp | 17 +++++++++++++++--
trunk/boost/accumulators/statistics/mean.hpp | 2 +-
2 files changed, 16 insertions(+), 3 deletions(-)
Modified: trunk/boost/accumulators/numeric/functional.hpp
==============================================================================
--- trunk/boost/accumulators/numeric/functional.hpp (original)
+++ trunk/boost/accumulators/numeric/functional.hpp 2008-01-03 19:41:44 EST (Thu, 03 Jan 2008)
@@ -71,6 +71,12 @@
{
typedef Left &type;
};
+
+ namespace detail
+ {
+ template<typename T>
+ T &lvalue_of();
+ }
}
// TODO: handle complex weight, valarray, MTL vectors
@@ -83,7 +89,10 @@
template<typename Arg> \
struct result_of_ ## Name \
{ \
- BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested, Op (*(Arg*)0)) \
+ BOOST_TYPEOF_NESTED_TYPEDEF_TPL( \
+ nested \
+ , Op boost::numeric::functional::detail::lvalue_of<Arg>() \
+ ) \
typedef typename nested::type type; \
}; \
template<typename Arg, typename EnableIf> \
@@ -154,7 +163,11 @@
/// INTERNAL ONLY
///
#define BOOST_NUMERIC_FUNCTIONAL_DEDUCED(Left, Op, Right) \
- BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested, (*(Left*)0) Op (*(Right*)0)) \
+ BOOST_TYPEOF_NESTED_TYPEDEF_TPL( \
+ nested \
+ , boost::numeric::functional::detail::lvalue_of<Left>() Op \
+ boost::numeric::functional::detail::lvalue_of<Right>() \
+ ) \
typedef typename nested::type type; \
/**/
Modified: trunk/boost/accumulators/statistics/mean.hpp
==============================================================================
--- trunk/boost/accumulators/statistics/mean.hpp (original)
+++ trunk/boost/accumulators/statistics/mean.hpp 2008-01-03 19:41:44 EST (Thu, 03 Jan 2008)
@@ -144,7 +144,7 @@
{
extractor<tag::mean> const mean = {};
extractor<tag::mean_of_weights> const mean_of_weights = {};
- BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, mean_of_variates, (typename)(typename));
+ BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, mean_of_variates, (typename)(typename))
}
using extract::mean;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk