Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59001 - in sandbox/numeric_bindings/libs/numeric/bindings/tools: . templates
From: rutger_at_[hidden]
Date: 2010-01-14 09:07:13


Author: rutger
Date: 2010-01-14 09:07:12 EST (Thu, 14 Jan 2010)
New Revision: 59001
URL: http://svn.boost.org/trac/boost/changeset/59001

Log:
Using enable_if / disable_if to remove ambigious overloads. This occurs when the template parameter Workspace conflicts with an other overload, e.g., of the complex variant, with fewer arguments.
--This line, and those below, ill be ignored--

M tools/lapack_generator.py
M tools/templates/lapack.hpp

Text files modified:
   sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py | 1 +
   sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp | 6 ++++--
   2 files changed, 5 insertions(+), 2 deletions(-)

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/lapack_generator.py 2010-01-14 09:07:12 EST (Thu, 14 Jan 2010)
@@ -361,6 +361,7 @@
       # generate the word "matrix" or "vector", to select the right traits
       first_typename_datatype = first_typename[0:6].lower()
       level2_template = level2_template.replace( "$FIRST_TYPENAME", first_typename )
+ level2_template = level2_template.replace( "$LAST_TYPENAME", level1_type_arg_list[-1][9:] )
       level2_template = level2_template.replace( "$TYPEOF_FIRST_TYPENAME", first_typename_datatype )
       level2_template = level2_template.replace( "$CALL_LEVEL1", ", ".join( call_level1_arg_list ) )
       level2_template = level2_template.replace( "$TYPES", ", ".join( level1_type_arg_list ) )

Modified: sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp
==============================================================================
--- sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp (original)
+++ sandbox/numeric_bindings/libs/numeric/bindings/tools/templates/lapack.hpp 2010-01-14 09:07:12 EST (Thu, 14 Jan 2010)
@@ -214,7 +214,8 @@
 // * User-defined workspace
 //
 template< $TYPES, typename Workspace >
-inline $INTEGER_TYPE $groupname( $LEVEL2, Workspace work ) {
+inline typename boost::enable_if< detail::is_workspace< Workspace >, $INTEGER_TYPE >::type
+$groupname( $LEVEL2, Workspace work ) {
     return $groupname_impl< typename value< $FIRST_TYPENAME >::type >::invoke( $CALL_LEVEL1, work );
 }
 
@@ -224,7 +225,8 @@
 // * Default workspace-type (optimal)
 //
 template< $TYPES >
-inline $INTEGER_TYPE $groupname( $LEVEL2 ) {
+inline typename boost::disable_if< detail::is_workspace< $LAST_TYPENAME >, $INTEGER_TYPE >::type
+$groupname( $LEVEL2 ) {
     return $groupname_impl< typename value< $FIRST_TYPENAME >::type >::invoke( $CALL_LEVEL1, optimal_workspace() );
 }
 $TEMPLATE[setup_min_workspace]


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