https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make milena work correctly with g++-2.95.
* mln/core/exact.hh (force_exact): Move in...
* mln/core/internal/force_exact.hh: ...this new file.
(force_exact_): Now a method and g++-2.95 compatible.
* mln/core/concept/genpoint.hh: Update.
* mln/core/dpoints_piter.hh: Update.
* mln/core/internal/coord_impl.hh: Update.
* tests/window2d.cc: New.
* tests/box2d.cc: New.
* tests/point2d.cc: New.
* tests/dpoint2d.cc: New.
* mln/fun: New.
* mln/fun/all.hh: New.
* mln/core/window.hh (is_centered): Update.
* doc/Doxyfile.in (PREDEFINED): Add extra macros.
* mln/core/point.hh (point_): Change arg from val to fun.
* mln/core/dpoint.hh (dpoint_): Change arg from val to fun.
* mln/core/image2d.hh: Add explicit typedefs.
doc/Doxyfile.in | 12 +++++
mln/core/concept/genpoint.hh | 28 +++++++----
mln/core/dpoint.hh | 11 ++--
mln/core/dpoints_piter.hh | 2
mln/core/exact.hh | 84 -----------------------------------
mln/core/image2d.hh | 11 ++++
mln/core/internal/coord_impl.hh | 55 +++++++++++++++--------
mln/core/internal/force_exact.hh | 62 ++++++++++++++++++++++++++
mln/core/point.hh | 15 +++---
mln/core/window.hh | 3 -
mln/fun/all.hh | 92 +++++++++++++++++++++++++++++++++++++++
tests/box2d.cc | 42 +++++++++++++++++
tests/dpoint2d.cc | 50 +++++++++++++++++++++
tests/point2d.cc | 59 +++++++++++++++++++++++++
tests/window2d.cc | 43 ++++++++++++++++++
15 files changed, 445 insertions(+), 124 deletions(-)
Index: tests/window2d.cc
--- tests/window2d.cc (revision 0)
+++ tests/window2d.cc (revision 0)
@@ -0,0 +1,43 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/window2d.cc
+ *
+ * \brief Tests on mln::window2d.
+ */
+
+#include <mln/core/window2d.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ window2d w;
+ std::cout << w.is_centered() << std::endl;
+}
Index: tests/box2d.cc
--- tests/box2d.cc (revision 0)
+++ tests/box2d.cc (revision 0)
@@ -0,0 +1,42 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/box2d.cc
+ *
+ * \brief Tests on mln::box2d.
+ */
+
+#include <mln/core/box2d.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ box2d b(2, 3);
+}
Index: tests/point2d.cc
--- tests/point2d.cc (revision 0)
+++ tests/point2d.cc (revision 0)
@@ -0,0 +1,59 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/point2d.cc
+ *
+ * \brief Tests on mln::point2d.
+ */
+
+#include <mln/core/point2d.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ point2d p, q;
+
+ // assignment
+
+ p[0] = 4;
+ p.row() += 1;
+ mln_assertion(p.row() = 5 && p[0] = 5);
+ p[1] = 0;
+ p.col() += 1;
+ mln_assertion(p.col() = 1 && p[1] = 1);
+
+ // construction
+ q = mk_point2d(5, 1);
+ mln_assertion(p = q);
+
+ q.set_all(0);
+ for (unsigned i = 0; i < p.dim; ++i)
+ mln_assertion(q[i] = 0);
+}
Index: tests/dpoint2d.cc
--- tests/dpoint2d.cc (revision 0)
+++ tests/dpoint2d.cc (revision 0)
@@ -0,0 +1,50 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/dpoint2d.cc
+ *
+ * \brief Tests on mln::dpoint2d.
+ */
+
+#include <mln/core/dpoint2d.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ point2d p, q;
+ dpoint2d dp;
+
+ p = mk_point2d(1, 2);
+ q = mk_point2d(4, 7);
+ dp = mk_dpoint2d(3, 5);
+
+ mln_assertion(dp = q - p);
+ mln_assertion(q = p + dp);
+}
Index: doc/Doxyfile.in
--- doc/Doxyfile.in (revision 1000)
+++ doc/Doxyfile.in (working copy)
@@ -1042,6 +1042,18 @@
# instead of the = operator.
PREDEFINED = \
+ "mln_piter(T)=typename T::piter" \
+ "mln_fwd_piter(T)=typename T::fwd_piter" \
+ "mln_bkd_piter(T)=typename T::bkd_piter" \
+ "mln_qiter(T)=typename T::qiter" \
+ "mln_fwd_qiter(T)=typename T::fwd_qiter" \
+ "mln_bkd_qiter(T)=typename T::bkd_qiter" \
+ "mln_niter(T)=typename T::niter" \
+ "mln_fwd_niter(T)=typename T::fwd_niter" \
+ "mln_bkd_niter(T)=typename T::bkd_niter" \
+ "mln_value(T)=typename T::value" \
+ "mln_rvalue(T)=typename T::rvalue" \
+ "mln_lvalue(T)=typename T::lvalue" \
"mln_coord(T)=typename T::coord" \
"mln_point(T)=typename T::point" \
"mln_dpoint(T)=typename T::dpoint"
Index: mln/core/dpoints_piter.hh
--- mln/core/dpoints_piter.hh (revision 1000)
+++ mln/core/dpoints_piter.hh (working copy)
@@ -112,7 +112,7 @@
dpoints_fwd_piter<D>::dpoints_fwd_piter(const Dps& dps,
const GenPoint<Pref>& p_ref)
: dps_(exact(dps).vec()),
- p_ref_(* force_exact<Pref>(p_ref).pointer())
+ p_ref_(* p_ref.force_exact_().pointer())
{
invalidate();
}
Index: mln/core/point.hh
--- mln/core/point.hh (revision 1000)
+++ mln/core/point.hh (working copy)
@@ -83,9 +83,10 @@
*/
point_();
- /*! \brief Constructor; all coordinates are set to the value \p c.
+ /*! \brief Constructor; coordinates are set by function \p f.
*/
- point_(C c);
+ template <typename F>
+ point_(F f);
/*! \brief Set all coordinates to the value \p c.
*/
@@ -102,14 +103,14 @@
C point_<n,C>::operator[](unsigned i) const
{
assert(i < n);
- return coord_[i];
+ return this->coord_[i];
}
template <unsigned n, typename C>
C& point_<n,C>::operator[](unsigned i)
{
assert(i < n);
- return coord_[i];
+ return this->coord_[i];
}
template <unsigned n, typename C>
@@ -118,9 +119,11 @@
}
template <unsigned n, typename C>
- point_<n,C>::point_(C c)
+ template <typename F>
+ point_<n,C>::point_(F f)
{
- set_all(c);
+ for (unsigned i = 0; i < n; ++i)
+ coord_[i] = f(i);
}
template <unsigned n, typename C>
Index: mln/core/concept/genpoint.hh
--- mln/core/concept/genpoint.hh (revision 1000)
+++ mln/core/concept/genpoint.hh (working copy)
@@ -36,8 +36,10 @@
# include <mlc/same_coord.hh>
# include <mln/core/concept/object.hh>
+
# include <mln/core/macros.hh>
# include <mln/core/contract.hh>
+# include <mln/core/internal/force_exact.hh>
namespace mln
@@ -57,7 +59,8 @@
* class contents.
*/
template <typename E>
- struct GenPoint // stand-alone class!
+ struct GenPoint
+ // : virtual internal::object_<E>
{
/*
@@ -75,8 +78,11 @@
coord operator[](unsigned i) const;
*/
+ mln_internal_add_force_exact_(GenPoint<E>)
+
protected:
GenPoint();
+
};
@@ -189,8 +195,9 @@
template <typename E>
GenPoint<E>::GenPoint()
{
- const int dim = E::dim;
+ int dim = E::dim;
mln_invariant(dim > 0);
+ dim = 0;
typedef mln_point(E) point;
typedef mln_dpoint(E) dpoint;
typedef mln_coord(E) coord;
@@ -204,8 +211,8 @@
bool operator=(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
{
// FIXME: mlc::same_grid<Pl, Pr>::check();
- const Pl& lhs_ = force_exact<Pl>(lhs);
- const Pr& rhs_ = force_exact<Pr>(rhs);
+ const Pl& lhs_ = lhs.force_exact_();
+ const Pr& rhs_ = rhs.force_exact_();
mlc::same_point<Pl, Pr>::check();
for (unsigned i = 0; i < Pl::dim; ++i)
if (lhs_[i] != rhs_[i])
@@ -217,8 +224,8 @@
bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>&
rhs)
{
// FIXME: mlc::same_grid<Pl, Pr>::check();
- const Pl& lhs_ = force_exact<Pl>(lhs);
- const Pr& rhs_ = force_exact<Pr>(rhs);
+ const Pl& lhs_ = lhs.force_exact_();
+ const Pr& rhs_ = rhs.force_exact_();
for (unsigned i = 0; i < Pl::dim; ++i)
{
if (lhs_[i] = rhs_[i])
@@ -235,8 +242,8 @@
mlc::equal<mln_dpoint(Pl), mln_dpoint(Pr)>::check();
// FIXME: mlc::same_grid<Pl, Pr>::check();
mlc::same_coord<Pl, Pr>::check();
- const Pl& lhs_ = force_exact<Pl>(lhs);
- const Pr& rhs_ = force_exact<Pr>(rhs);
+ const Pl& lhs_ = lhs.force_exact_();
+ const Pr& rhs_ = rhs.force_exact_();
mln_dpoint(Pl) tmp;
for (unsigned i = 0; i < Pl::dim; ++i)
tmp[i] = lhs_[i] - rhs_[i];
@@ -248,7 +255,7 @@
mln_point(P)
operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs)
{
- const P& lhs_ = force_exact<P>(lhs);
+ const P& lhs_ = lhs.force_exact_();
mln_point(P) tmp;
for (unsigned i = 0; i < P::dim; ++i)
tmp[i] = lhs_[i] + rhs[i];
@@ -258,7 +265,8 @@
template <typename P>
std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>&
p)
{
- const P& p_ = force_exact<P>(p);
+ const P& p_ = p.force_exact_();
+
ostr << '(';
for (unsigned i = 0; i < P::dim; ++i)
{
Index: mln/core/dpoint.hh
--- mln/core/dpoint.hh (revision 1000)
+++ mln/core/dpoint.hh (working copy)
@@ -83,9 +83,10 @@
*/
dpoint_();
- /*! \brief Constructor; all coordinates are set to the value \p c.
+ /*! \brief Constructor; coordinates are set by function \p f.
*/
- dpoint_(C c);
+ template <typename F>
+ dpoint_(F f);
/*! \brief Set all coordinates to the value \p c.
*/
@@ -118,9 +119,11 @@
}
template <unsigned n, typename C>
- dpoint_<n,C>::dpoint_(C c)
+ template <typename F>
+ dpoint_<n,C>::dpoint_(F f)
{
- set_all(c);
+ for (unsigned i = 0; i < n; ++i)
+ coord_[i] = f(i);
}
template <unsigned n, typename C>
Index: mln/core/exact.hh
--- mln/core/exact.hh (revision 1000)
+++ mln/core/exact.hh (working copy)
@@ -66,57 +66,6 @@
/// \}
- namespace internal
- {
-
- template <typename E, typename O>
- struct helper_force_exact_
- {
- typedef E ret;
- };
-
- template <typename E, typename O>
- struct helper_force_exact_< E, const O >
- {
- typedef const E ret;
- };
-
- } // end of namespace mln::internal
-
-
- /*! \brief Violent exact cast routine.
- *
- * This cast is an alternative to the mln::exact cast. It is used
- * for objects than do not derive from mln::Object.
- *
- * It preserves the nature (pointer or reference, const or mutable)
- * of its argument. The parameter \a E should not have qualifiers.
- *
- * \warning Prefer not to use this cast!
- *
- * \see mln::exact
- * \todo Move into mln::internal.
- */
- /// \{
-
- template <typename E, typename O>
- E* force_exact(O* ptr);
-
- template <typename E, typename O>
- const E* force_exact(const O* ptr);
-
- template <typename E, typename O>
- typename internal::helper_force_exact_<E, O>::ret & // help g++-3.3
- force_exact(O& ref);
-
- /// \}
-
-
-// template <typename E, typename O>
-// E& force_exact(O& ref);
-
-// template <typename E, typename O>
-// const E& force_exact(const O& ref);
# ifndef MLN_INCLUDE_ONLY
@@ -147,39 +96,6 @@
return *(const E*)(const void*)(&ref);
}
- // force_exact
-
- template <typename E, typename O>
- E* force_exact(O* ptr)
- {
- return (E*)(void*)ptr;
- }
-
- template <typename E, typename O>
- const E* force_exact(const O* ptr)
- {
- return (const E*)(const void*)ptr;
- }
-
-// template <typename E, typename O>
-// E& force_exact(O& ref)
-// {
-// return *(E*)(void*)(&ref);
-// }
-
-// template <typename E, typename O>
-// const E& force_exact(const O& ref)
-// {
-// return *(const E*)(const void*)(&ref);
-// }
-
- template <typename E, typename O>
- typename internal::helper_force_exact_<E, O>::ret &
- force_exact(O& ref)
- {
- return *(E*)(void*)(&ref);
- }
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: mln/core/window.hh
--- mln/core/window.hh (revision 1000)
+++ mln/core/window.hh (working copy)
@@ -36,6 +36,7 @@
# include <mln/core/concept/window.hh>
# include <mln/core/internal/set_of.hh>
# include <mln/core/dpoint.hh>
+# include <mln/fun/all.hh>
namespace mln
@@ -100,7 +101,7 @@
template <typename D>
bool window_<D>::is_centered() const
{
- static const D origin(0);
+ static const D origin = all(0);
return this->has(origin);
}
Index: mln/core/image2d.hh
--- mln/core/image2d.hh (revision 1000)
+++ mln/core/image2d.hh (working copy)
@@ -48,6 +48,17 @@
template <typename T>
struct image2d : public internal::image_base_< box2d, image2d<T> >
{
+
+ // warning: just to make effective types appear in Doxygen
+ typedef box2d pset;
+ typedef point2d psite;
+ typedef point2d point;
+ typedef mln_fwd_piter(box2d) fwd_piter;
+ typedef mln_bkd_piter(box2d) bkd_piter;
+ typedef fwd_piter piter;
+ // end of warning
+
+
/// Value associated type.
typedef T value;
Index: mln/core/internal/force_exact.hh
--- mln/core/internal/force_exact.hh (revision 0)
+++ mln/core/internal/force_exact.hh (revision 0)
@@ -0,0 +1,62 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_INTERNAL_FORCE_EXACT_HH
+# define MLN_CORE_INTERNAL_FORCE_EXACT_HH
+
+/*! \file mln/core/internal/force_exact.hh
+ *
+ * \brief Definition of a macro for internal use only.
+ */
+
+
+/*! \brief Macro to add a violent exact cast method.
+ *
+ * \internal
+ *
+ * This cast is an alternative to the mln::exact cast. It is used
+ * for objects than do not derive from mln::Object.
+ *
+ * \warning Do not to use this cast!
+ *
+ * \see mln::exact
+ */
+
+# define mln_internal_add_force_exact_(Type) \
+ \
+ E& force_exact_() const \
+ { \
+ static const E exact_obj; \
+ static const Type& exact_obj_ref = exact_obj; \
+ static const int exact_offset = \
+ (const char*)(void*)(&exact_obj_ref) \
+ - (const char*)(void*)(&exact_obj); \
+ return *(E*)((char*)(this) - exact_offset); \
+ }
+
+
+#endif // ! MLN_CORE_INTERNAL_FORCE_EXACT_HH
Index: mln/core/internal/coord_impl.hh
--- mln/core/internal/coord_impl.hh (revision 1000)
+++ mln/core/internal/coord_impl.hh (working copy)
@@ -30,9 +30,12 @@
/*! \file mln/core/internal/coord_impl.hh
*
+ * \internal
+ *
* \brief Define some implementation classes for generalized points.
*/
+# include <mln/core/internal/force_exact.hh>
# include <mln/core/concept/object.hh>
@@ -42,6 +45,13 @@
namespace internal
{
+ template <typename E>
+ struct coord_impl_base_
+ {
+ mln_internal_add_force_exact_(coord_impl_base_<E>)
+ };
+
+
// coord_impl
/*! \brief Implementation class to equip generalized points with
@@ -54,12 +64,17 @@
template <typename C, typename E>
struct coord_impl_<1, C, E>
+ : coord_impl_base_<E>
{
C ind() const;
+ private:
+ typedef coord_impl_<1, C, E> self_;
+
};
template <typename C, typename E>
struct coord_impl_<2, C, E>
+ : coord_impl_base_<E>
{
C row() const;
C col() const;
@@ -67,6 +82,7 @@
template <typename C, typename E>
struct coord_impl_<3, C, E>
+ : coord_impl_base_<E>
{
C sli() const;
C row() const;
@@ -81,6 +97,7 @@
template <typename C, typename E>
struct mutable_coord_impl_<1, C, E>
+ : coord_impl_base_<E>
{
C ind() const;
C& ind();
@@ -88,6 +105,7 @@
template <typename C, typename E>
struct mutable_coord_impl_<2, C, E>
+ : coord_impl_base_<E>
{
C row() const;
C& row();
@@ -97,6 +115,7 @@
template <typename C, typename E>
struct mutable_coord_impl_<3, C, E>
+ : coord_impl_base_<E>
{
C sli() const;
C& sli();
@@ -116,7 +135,7 @@
template <typename C, typename E>
C coord_impl_<1, C, E>::ind() const
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
// 2
@@ -124,13 +143,13 @@
template <typename C, typename E>
C coord_impl_<2, C, E>::row() const
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C coord_impl_<2, C, E>::col() const
{
- return force_exact<E>(*this)[1];
+ return this->force_exact_()[1];
}
// 3
@@ -138,19 +157,19 @@
template <typename C, typename E>
C coord_impl_<3, C, E>::sli() const
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C coord_impl_<3, C, E>::row() const
{
- return force_exact<E>(*this)[1];
+ return this->force_exact_()[1];
}
template <typename C, typename E>
C coord_impl_<3, C, E>::col() const
{
- return force_exact<E>(*this)[2];
+ return this->force_exact_()[2];
}
@@ -161,13 +180,13 @@
template <typename C, typename E>
C mutable_coord_impl_<1, C, E>::ind() const
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C& mutable_coord_impl_<1, C, E>::ind()
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
// 2
@@ -175,25 +194,25 @@
template <typename C, typename E>
C mutable_coord_impl_<2, C, E>::row() const
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C& mutable_coord_impl_<2, C, E>::row()
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C mutable_coord_impl_<2, C, E>::col() const
{
- return force_exact<E>(*this)[1];
+ return this->force_exact_()[1];
}
template <typename C, typename E>
C& mutable_coord_impl_<2, C, E>::col()
{
- return force_exact<E>(*this)[1];
+ return this->force_exact_()[1];
}
// 3
@@ -201,37 +220,37 @@
template <typename C, typename E>
C mutable_coord_impl_<3, C, E>::sli() const
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C& mutable_coord_impl_<3, C, E>::sli()
{
- return force_exact<E>(*this)[0];
+ return this->force_exact_()[0];
}
template <typename C, typename E>
C mutable_coord_impl_<3, C, E>::row() const
{
- return force_exact<E>(*this)[1];
+ return this->force_exact_()[1];
}
template <typename C, typename E>
C& mutable_coord_impl_<3, C, E>::row()
{
- return force_exact<E>(*this)[1];
+ return this->force_exact_()[1];
}
template <typename C, typename E>
C mutable_coord_impl_<3, C, E>::col() const
{
- return force_exact<E>(*this)[2];
+ return this->force_exact_()[2];
}
template <typename C, typename E>
C& mutable_coord_impl_<3, C, E>::col()
{
- return force_exact<E>(*this)[2];
+ return this->force_exact_()[2];
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/fun/all.hh
--- mln/fun/all.hh (revision 0)
+++ mln/fun/all.hh (revision 0)
@@ -0,0 +1,92 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_FUN_ALL_HH
+# define MLN_FUN_ALL_HH
+
+/*! \file mln/fun/all.hh
+ *
+ * \brief FIXME.
+ */
+
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ template <typename T>
+ struct all
+ {
+ all(T t);
+ template <typename U>
+ T operator()(const U&) const;
+ private:
+ T t_;
+ };
+
+ } // end of namespace mln::fun
+
+ template <typename T>
+ fun::all<T> all(T t);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace fun
+ {
+
+ template <typename T>
+ all<T>::all(T t)
+ : t_(t)
+ {
+ }
+
+ template <typename T>
+ template <typename U>
+ T
+ all<T>::operator()(const U&) const
+ {
+ return t_;
+ }
+
+ } // end of namespace mln::fun
+
+ template <typename T>
+ fun::all<T> all(T t)
+ {
+ fun::all<T> tmp(t);
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_FUN_ALL_HH