Changeset 3788


Ignore:
Timestamp:
Jan 29, 2019, 7:08:25 AM (6 months ago)
Author:
Peter
Message:

avoid compiler warnings with GCC v6.4.0

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/negative_binomial.cc

    r3663 r3788  
    3232#include "yat/utility/Vector.h"
    3333
     34#include <cmath>
    3435#include <vector>
    3536
     
    107108              << "\n";
    108109
    109   if (abs(stats3.mean() - alpha) > stats3.std()) {
     110  if (std::fabs(stats3.mean() - alpha) > stats3.std()) {
    110111    suite.add(false);
    111112    suite.err() << "incorrect alpha\n";
  • trunk/yat/random/copy_k_of_n.h

    r3454 r3788  
    7171    DiscreteUniform rnd;
    7272    while (n) {
    73       if (rnd(n)<k) {
     73      if (rnd(n)<static_cast<unsigned long int>(k)) {
    7474        --k;
    7575        *out = *it;
  • trunk/yat/utility/concept_check.h

    r3775 r3788  
    3737namespace yat {
    3838namespace utility {
     39
     40  namespace detail {
     41    template<typename T>
     42    void avoid_compiler_warning(const T& t) {}
     43  }
     44
    3945
    4046  /**
     
    8389      const_iterator iter_ = t_.begin();
    8490      iter_ = t_.end();
     91      detail::avoid_compiler_warning(iter_);
    8592      const_row_iterator row_iter_ = t_.begin_row(0);
    8693      row_iter_ = t_.end_row(0);
     94      detail::avoid_compiler_warning(row_iter_);
    8795      const_column_iterator col_iter_ = t_.begin_column(0);
    8896      col_iter_ = t_.end_column(0);
     97      detail::avoid_compiler_warning(col_iter_);
    8998      const_reference r = t_(0,0);
    9099      value_ = r;
    91100      size_t n = t_.rows();
    92101      n = t_.columns();
    93       some_func(n);
     102      detail::avoid_compiler_warning(n);
    94103      using boost_concepts::ReadableIterator;
    95104      BOOST_CONCEPT_ASSERT((ReadableIterator<const_iterator>));
     
    99108
    100109  private:
    101     void some_func(size_t x) const {}
    102110    T t_;
    103111    value_type value_;
     
    142150      iterator iter_ = t_.begin();
    143151      iter_ = t_.end();
     152      detail::avoid_compiler_warning(iter_);
    144153      row_iterator row_iter_ = t_.begin_row(0);
    145154      row_iter_ = t_.end_row(0);
     155      detail::avoid_compiler_warning(row_iter_);
    146156      column_iterator col_iter_ = t_.begin_column(0);
    147157      col_iter_ = t_.end_column(0);
     158      detail::avoid_compiler_warning(col_iter_);
    148159      reference r = t_(0,0);
    149160      t_(0,0) = r;
     161      detail::avoid_compiler_warning(r);
    150162      using boost::Mutable_RandomAccessIterator; // just to avoid long lines
    151163      BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<iterator>));
     
    246258  private:
    247259    void constraints(yat::utility::unweighted_iterator_tag t) const
    248     { 
     260    {
    249261      BOOST_CONCEPT_ASSERT((boost::Convertible<value_type, double>));
    250262    }
     
    260272     \brief Concept check for a \ref concept_distance
    261273
    262      This class is intended to be used in a <a 
     274     This class is intended to be used in a <a
    263275     href="\boost_url/concept_check/using_concept_check.htm">
    264276     BOOST_CONCEPT_ASSERT </a>
     
    295307      d += distance_(weighted, weighted, unweighted);
    296308      d += distance_(weighted, weighted, weighted);
    297       // avoid compiler warning
    298       func(d);
    299     }
    300   private:
    301     void func(double x) {}
     309      detail::avoid_compiler_warning(d);
     310    }
     311  private:
    302312    T distance_;
    303313  };
Note: See TracChangeset for help on using the changeset viewer.