[Debian-astro-commits] [gyoto] 70/221: Change GYOTO_ARRAY if Boost is not available to compile fine with C++98 (e.g. gcc-4.4)
Thibaut Jean-Claude Paumard
thibaut at moszumanska.debian.org
Fri May 22 20:52:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
thibaut pushed a commit to branch master
in repository gyoto.
commit b83fc4f4052b4fb8fc976ae01c224f9c7e7abca2
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date: Wed Oct 22 15:17:05 2014 +0200
Change GYOTO_ARRAY if Boost is not available to compile fine with C++98 (e.g. gcc-4.4)
---
include/GyotoScreen.h | 8 ++++++--
lib/Screen.C | 22 ++++++++++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/include/GyotoScreen.h b/include/GyotoScreen.h
index fbb29a3..4828812 100644
--- a/include/GyotoScreen.h
+++ b/include/GyotoScreen.h
@@ -33,8 +33,12 @@
#include <boost/array.hpp>
#define GYOTO_ARRAY boost::array
#else
-#include <array>
-#define GYOTO_ARRAY std::array
+template <typename T, size_t sz> class GYOTO_ARRAY {
+ private:
+ T buf[sz];
+ public:
+ T& operator[](size_t c) { return buf[c] ; }
+};
#endif
namespace Gyoto {
diff --git a/lib/Screen.C b/lib/Screen.C
index 7bf3ccb..5b129f7 100644
--- a/lib/Screen.C
+++ b/lib/Screen.C
@@ -1220,7 +1220,7 @@ GYOTO_ARRAY<size_t, 2> Screen::Coord2dSet::operator* () const {
else
throwError("Coord2dSet of kind angle should not be dereferenced");
// avoid warning
- GYOTO_ARRAY<size_t, 2> a = {0, 0};
+ GYOTO_ARRAY<size_t, 2> a;
return a;
}
@@ -1230,7 +1230,7 @@ GYOTO_ARRAY<double, 2> Screen::Coord2dSet::angles () const {
else
throwError("angles() should not be called on Coord2dSet of kind pixel");
// avoid warning
- GYOTO_ARRAY<double, 2> a = {0., 0.};
+ GYOTO_ARRAY<double, 2> a;
return a;
}
@@ -1244,7 +1244,13 @@ Screen::Grid::Grid(Coord1dSet &iset, Coord1dSet &jset,
{}
GYOTO_ARRAY<size_t, 2> Screen::Grid::operator* () const {
+#if defined HAVE_BOOST
GYOTO_ARRAY<size_t, 2> ij = {*iset_, *jset_};
+#else
+ GYOTO_ARRAY<size_t, 2> ij;
+ ij[0]=*iset_;
+ ij[1]=*jset_;
+#endif
return ij;
}
void Screen::Grid::begin() {iset_.begin(); jset_.begin();}
@@ -1345,11 +1351,23 @@ bool Screen::Bucket::valid() {return alpha_.valid() && delta_.valid();}
size_t Screen::Bucket::size(){return alpha_.size();}
Screen::Coord2dSet& Screen::Bucket::operator++(){++alpha_; ++delta_;}
GYOTO_ARRAY<double, 2> Screen::Bucket::angles() const {
+#if defined HAVE_BOOST
GYOTO_ARRAY<double, 2> out {alpha_.angle(), delta_.angle()};
+#else
+ GYOTO_ARRAY<double, 2> out;
+ out[0]=alpha_.angle();
+ out[1]=delta_.angle();
+#endif
return out;
}
GYOTO_ARRAY<size_t, 2> Screen::Bucket::operator* () const {
+#if defined HAVE_BOOST
GYOTO_ARRAY<size_t, 2> ij = {*alpha_, *delta_};
+#else
+ GYOTO_ARRAY<size_t, 2> ij;
+ ij[0]=*alpha_;
+ ij[1]=*delta_;
+#endif
return ij;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git
More information about the Debian-astro-commits
mailing list