Skip to content

Commit

Permalink
Merge pull request #4 from kleinhenz/gcc_bug
Browse files Browse the repository at this point in the history
Gcc bug
  • Loading branch information
aeantipov authored Feb 3, 2017
2 parents 60d1307 + c837190 commit e29ca44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ matrix:
packages:
- g++-5
env: CXX=g++-5
- compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env: CXX=g++-6
- compiler: clang
addons:
apt:
Expand Down
8 changes: 4 additions & 4 deletions gftools/kmesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <map>
#include <numeric>
#include <cassert>
#include <type_traits>

#include "grid_base.hpp"
#include "almost_equal.hpp"
Expand Down Expand Up @@ -30,8 +31,8 @@ class kmesh : public grid_base<real_type, kmesh>
///The second return value is the index.
///The third return value 'weight' measures how close the point is to a grid point
std::tuple <bool, size_t, real_type> find(real_type in) const ;
template <class Obj> auto integrate(const Obj &in) const ->decltype(in(vals_[0]));

template <class Obj> auto integrate(const Obj &in) const -> typename std::result_of<Obj(decltype(vals_[0]))>::type;
template <class Obj> auto eval(Obj &in, real_type x) const ->decltype(in[0]);
template <class Obj> auto eval(Obj &in, point x) const ->decltype(in[0]) { return base::eval(in,x); }

Expand Down Expand Up @@ -91,9 +92,8 @@ inline auto kmesh::eval(Obj &in, real_type x) const ->decltype(in[0])
return eval(in,p);
}


template <class Obj>
auto kmesh::integrate(const Obj &in) const -> decltype(in(vals_[0]))
auto kmesh::integrate(const Obj &in) const -> typename std::result_of<Obj(decltype(vals_[0]))>::type
{
decltype(in(vals_[0])) R = in(real_type(vals_[0]));
R=std::accumulate(vals_.begin()+1, vals_.end(), R,[&](decltype(in(vals_[0]))& y,decltype(vals_[0]) & x) {return y+in(x);});
Expand Down

0 comments on commit e29ca44

Please sign in to comment.