Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73763 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-14 17:31:07


Author: trademark
Date: 2011-08-14 17:31:07 EDT (Sun, 14 Aug 2011)
New Revision: 73763
URL: http://svn.boost.org/trac/boost/changeset/73763

Log:
Correction of bugs (on iterator, and return type of compute_checkdigit).
Text files modified:
   sandbox/SOC/2011/checks/boost/checks/basic_checks.hpp | 14 +++++++-------
   1 files changed, 7 insertions(+), 7 deletions(-)

Modified: sandbox/SOC/2011/checks/boost/checks/basic_checks.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/basic_checks.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/basic_checks.hpp 2011-08-14 17:31:07 EDT (Sun, 14 Aug 2011)
@@ -20,20 +20,20 @@
   namespace checks{
 
 template <typename algorithm, typename size_contract, typename iterator>
-int compute_checksum(const iterator &begin, const iterator &end )
+int compute_checksum(const iterator &seq_begin, const iterator &seq_end )
 {
+ iterator seq_begin_cpy = iterator(seq_begin) ;
   unsigned int valid_value_counter = 0;
   int checksum = 0 ;
- while( begin != end )
+ while( seq_begin_cpy != seq_end )
   {
     try{
- int current_valid_value = algorithm::traduce_to_valid_value( *begin, valid_value_counter );
+ int current_valid_value = algorithm::traduce_to_valid_value( *seq_begin_cpy, valid_value_counter );
       algorithm::operate_on_valid_value( current_valid_value, valid_value_counter, checksum ) ;
       ++valid_value_counter ;
     }catch( boost::checks::traduction_exception ){
- }finally{
- ++begin ;
     }
+ ++seq_begin_cpy ;
   }
   size_contract::respect_size_contract( valid_value_counter );
   return checksum ;
@@ -66,14 +66,14 @@
 typename algorithm::checkdigit<check_range>::type compute_checkdigit (const check_range& check_seq)
 {
   int checksum = compute_checksum<algorithm, boost::checks::no_null_size_contract<> >( check_seq ) ;
- return algorithm::compute_checkdigit( checksum ) ;
+ return algorithm::compute_checkdigit<typename algorithm::checkdigit<check_range>::type>( checksum ) ;
 }
 
 template <typename algorithm, size_t size_expected, typename check_range>
 typename algorithm::checkdigit<check_range>::type compute_checkdigit (const check_range& check_seq)
 {
   int checksum = compute_checksum<algorithm, boost::checks::strict_size_contract<size_expected> >( check_seq ) ;
- return algorithm::compute_checkdigit( checksum ) ;
+ return algorithm::compute_checkdigit<typename algorithm::checkdigit<check_range>::type>( checksum ) ;
 }
 
 


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