Changeset 3074


Ignore:
Timestamp:
Sep 3, 2013, 5:22:25 AM (8 years ago)
Author:
Peter
Message:

improve exception message; and prefer initialize ostringstream as empty as inited value is ignore after using operator<<

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/random/random.cc

    r2890 r3074  
    33/*
    44  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009, 2011, 2012 Peter Johansson
     5  Copyright (C) 2009, 2011, 2012, 2013 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    277277  {
    278278    if (range_>rng_->max()) {
    279       std::stringstream ss("DiscreteUniform::DiscreteUniform: ");
     279      std::ostringstream ss;
     280      ss << "DiscreteUniform::DiscreteUniform: ";
    280281      ss << n << " is too large for RNG " << rng_->name();
     282      ss << "; maximal argument is " << rng_->max();
    281283      throw utility::GSL_error(ss.str());
    282284    }
     
    296298    // underlying RNG
    297299    if (n>rng_->max()) {
    298       std::stringstream ss("DiscreteUniform::operator(unsigned long): ");
     300      std::ostringstream ss;
     301      ss << "DiscreteUniform::operator(unsigned long): ";
    299302      ss << n << " is too large for RNG " << rng_->name();
     303      ss << "; maximal argument is " << rng_->max();
    300304      throw utility::GSL_error(ss.str());
    301305    }
Note: See TracChangeset for help on using the changeset viewer.