Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73793 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-15 15:23:35


Author: trademark
Date: 2011-08-15 15:23:35 EDT (Mon, 15 Aug 2011)
New Revision: 73793
URL: http://svn.boost.org/trac/boost/changeset/73793

Log:
Change the reference iterator by copy iterator.
Add a function that help to reduce the interval of checked value if the size is not respected.
Text files modified:
   sandbox/SOC/2011/checks/boost/checks/basic_checks.hpp | 8 +++-----
   1 files changed, 3 insertions(+), 5 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-15 15:23:35 EDT (Mon, 15 Aug 2011)
@@ -20,20 +20,18 @@
   namespace checks{
 
 template <typename algorithm, typename size_contract, typename iterator>
-int compute_checksum(const iterator &seq_begin, const iterator &seq_end )
+int compute_checksum(iterator seq_begin, iterator seq_end )
 {
- iterator seq_begin_cpy = iterator(seq_begin) ;
   unsigned int valid_value_counter = 0;
   int checksum = 0 ;
- while( seq_begin_cpy != seq_end )
+ for(; seq_begin != seq_end && !size_contract::reach_one_past_the_end(valid_value_counter) ; ++seq_begin )
   {
     try{
- int current_valid_value = algorithm::traduce_to_valid_value( *seq_begin_cpy, valid_value_counter );
+ int current_valid_value = algorithm::traduce_to_valid_value( *seq_begin, valid_value_counter );
       algorithm::operate_on_valid_value( current_valid_value, valid_value_counter, checksum ) ;
       ++valid_value_counter ;
     }catch( boost::checks::traduction_exception ){
     }
- ++seq_begin_cpy ;
   }
   size_contract::respect_size_contract( valid_value_counter );
   return 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