Ticket #5399: boost_random_exceptions.2.patch

File boost_random_exceptions.2.patch, 5.2 KB (added by matthewbg@…, 11 years ago)

Now with requisite #includes

  • boost/random/inversive_congruential.hpp

    diff --git a/boost/random/inversive_congruential.hpp b/boost/random/inversive_congruential.hpp
    index 93604b3..fe37712 100644
    a b  
    2121#include <stdexcept>
    2222#include <boost/config.hpp>
    2323#include <boost/static_assert.hpp>
     24#include <boost/throw_exception.hpp>
    2425#include <boost/random/detail/config.hpp>
    2526#include <boost/random/detail/const_mod.hpp>
    2627
    public:  
    9697  template<class It> void seed(It& first, It last)
    9798  {
    9899    if(first == last)
    99       throw std::invalid_argument("inversive_congruential::seed");
     100      boost::throw_exception(std::invalid_argument(
     101          "inversive_congruential::seed"));
    100102    value = *first++;
    101103  }
    102104  IntType operator()()
  • boost/random/lagged_fibonacci.hpp

    diff --git a/boost/random/lagged_fibonacci.hpp b/boost/random/lagged_fibonacci.hpp
    index 20860da..21debdb 100644
    a b  
    2424#include <boost/config.hpp>
    2525#include <boost/limits.hpp>
    2626#include <boost/cstdint.hpp>
     27#include <boost/throw_exception.hpp>
    2728#include <boost/detail/workaround.hpp>
    2829#include <boost/random/linear_congruential.hpp>
    2930#include <boost/random/uniform_01.hpp>
    public:  
    158159      x[j] = *first & wordmask;
    159160    i = long_lag;
    160161    if(first == last && j < long_lag)
    161       throw std::invalid_argument("lagged_fibonacci::seed");
     162      boost::throw_exception(std::invalid_argument("lagged_fibonacci::seed"));
    162163  }
    163164
    164165  /**
    public:  
    411412    }
    412413    i = long_lag;
    413414    if(first == last && j < long_lag)
    414       throw std::invalid_argument("lagged_fibonacci_01::seed");
     415      boost::throw_exception(std::invalid_argument(
     416          "lagged_fibonacci_01::seed"));
    415417  }
    416418
    417419  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
  • boost/random/linear_congruential.hpp

    diff --git a/boost/random/linear_congruential.hpp b/boost/random/linear_congruential.hpp
    index 351b9c1..1bd3bd3 100644
    a b  
    2222#include <boost/config.hpp>
    2323#include <boost/limits.hpp>
    2424#include <boost/static_assert.hpp>
     25#include <boost/throw_exception.hpp>
    2526#include <boost/random/detail/config.hpp>
    2627#include <boost/random/detail/const_mod.hpp>
    2728#include <boost/detail/workaround.hpp>
    public:  
    139140  void seed(It& first, It last)
    140141  {
    141142    if(first == last)
    142       throw std::invalid_argument("linear_congruential::seed");
     143      boost::throw_exception(std::invalid_argument(
     144          "linear_congruential::seed"));
    143145    seed(*first++);
    144146  }
    145147
  • boost/random/linear_feedback_shift.hpp

    diff --git a/boost/random/linear_feedback_shift.hpp b/boost/random/linear_feedback_shift.hpp
    index 5e9b016..cf94640 100644
    a b  
    1919#include <stdexcept>
    2020#include <boost/config.hpp>
    2121#include <boost/static_assert.hpp>
     22#include <boost/throw_exception.hpp>
    2223#include <boost/limits.hpp>
    2324#include <boost/random/detail/config.hpp>
    2425
    public:  
    9596  template<class It> void seed(It& first, It last)
    9697  {
    9798    if(first == last)
    98       throw std::invalid_argument("linear_feedback_shift::seed");
     99      boost::throw_exception(std::invalid_argument(
     100          "linear_feedback_shift::seed"));
    99101    value = *first++;
    100102    assert(value >= (1 << (w-k)));
    101103  }
  • boost/random/mersenne_twister.hpp

    diff --git a/boost/random/mersenne_twister.hpp b/boost/random/mersenne_twister.hpp
    index fa80aa6..8b7f9f5 100644
    a b  
    2424#include <boost/static_assert.hpp>
    2525#include <boost/integer_traits.hpp>
    2626#include <boost/cstdint.hpp>
     27#include <boost/throw_exception.hpp>
    2728#include <boost/random/linear_congruential.hpp>
    2829#include <boost/detail/workaround.hpp>
    2930#include <boost/random/detail/config.hpp>
    public:  
    153154      x[j] = *first;
    154155    i = n;
    155156    if(first == last && j < n)
    156       throw std::invalid_argument("mersenne_twister::seed");
     157      boost::throw_exception(std::invalid_argument("mersenne_twister::seed"));
    157158  }
    158159 
    159160  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
  • boost/random/subtract_with_carry.hpp

    diff --git a/boost/random/subtract_with_carry.hpp b/boost/random/subtract_with_carry.hpp
    index ca5c78b..e8820ed 100644
    a b  
    2525#include <boost/limits.hpp>
    2626#include <boost/cstdint.hpp>
    2727#include <boost/static_assert.hpp>
     28#include <boost/throw_exception.hpp>
    2829#include <boost/detail/workaround.hpp>
    2930#include <boost/random/detail/config.hpp>
    3031#include <boost/random/detail/seed.hpp>
    public:  
    130131    for(j = 0; j < long_lag && first != last; ++j, ++first)
    131132      x[j] = *first % modulus;
    132133    if(first == last && j < long_lag)
    133       throw std::invalid_argument("subtract_with_carry::seed");
     134      boost::throw_exception(std::invalid_argument(
     135          "subtract_with_carry::seed"));
    134136    carry = (x[long_lag-1] == 0);
    135137    k = 0;
    136138   }
    public:  
    330332      }
    331333    }
    332334    if(first == last && j < long_lag)
    333       throw std::invalid_argument("subtract_with_carry_01::seed");
     335      boost::throw_exception(std::invalid_argument(
     336          "subtract_with_carry_01::seed"));
    334337    carry = (x[long_lag-1] ? 0 : 1 / _modulus);
    335338    k = 0;
    336339  }