Subject: [Boost-bugs] [Boost C++ Libraries] #6511: Division by scalar should use enable_if<>
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-01 20:38:09
#6511: Division by scalar should use enable_if<>
------------------------------------------------+---------------------------
Reporter: Sean Reilly <campreilly@â¦> | Owner: guwi17
Type: Bugs | Status: new
Milestone: To Be Determined | Component: uBLAS
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
------------------------------------------------+---------------------------
file: vector_expression.hpp lines 1409 through 1417
function: operator/( vector, scalar)
Should be using the enable_if<> macros just like the operator*() in lines
1397 through 1407 (just above it). Doing so allows further overloading of
operator/() for other types. Suggested change is...
Before:
{{{
#!python
// (v / t) [i] = v [i] / t
template<class E1, class T2>
BOOST_UBLAS_INLINE
typename vector_binary_scalar2_traits<E1, const T2,
scalar_divides<typename E1::value_type, T2> >::result_type
operator / (const vector_expression<E1> &e1,
const T2 &e2) {
typedef typename vector_binary_scalar2_traits<E1, const T2,
scalar_divides<typename E1::value_type, T2> >::expression_type
expression_type;
return expression_type (e1 (), e2);
}
}}}
After:
{{{
#!python
// (v / t) [i] = v [i] / t
template<class E1, class T2>
BOOST_UBLAS_INLINE
typename enable_if< is_convertible<T2, typename E1::value_type >,
typename vector_binary_scalar2_traits<E1, const T2,
scalar_multiplies<typename E1::value_type, T2> >::result_type
>::type
typename vector_binary_scalar2_traits<E1, const T2,
scalar_divides<typename E1::value_type, T2> >::result_type
operator / (const vector_expression<E1> &e1,
const T2 &e2) {
typedef typename vector_binary_scalar2_traits<E1, const T2,
scalar_divides<typename E1::value_type, T2> >::expression_type
expression_type;
return expression_type (e1 (), e2);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6511> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC