https://svn.lrde.epita.fr/svn/oln/trunk/extended
Index: ChangeLog
from Thierry Geraud <theo(a)lrde.epita.fr>
Add some math functions and clean up file deps.
* xtd/math.hh: Add includes.
* xtd/math/log.hh: New.
* xtd/math/floor.hh: New.
* xtd/math/log10.hh: New.
* xtd/math/tan.hh: New.
* xtd/math/atan.hh: New.
* xtd/math/cos.hh: New.
* xtd/math/trigo.hh: Remove; dispatch contents into several files.
* xtd/math/acos.hh: New.
* xtd/math/sin.hh: New.
* xtd/math/sqrt.hh: New.
* xtd/math/asin.hh: New.
* xtd/math/tanh.hh: New.
* xtd/math/exp.hh: New.
* xtd/math/cosh.hh: New.
* xtd/math/id.hh: Update includes.
* xtd/math/sinh.hh: New.
* xtd/math/atan2.hh: New.
* xtd/math/abs.hh: New.
* xtd/math/pow.hh: New.
* xtd/math/includes.hh: New.
* xtd/math/constraints.hh: New.
* xtd/math/ceil.hh: New.
* xtd/ops_expr.hh: Remove; dispatch contents into...
* xtd/internal/opmacros.hh: ...this new file and the following three
files.
* xtd/math/arith.hh: Update.
* xtd/math/cmp.hh: New.
* xtd/math/logic.hh: New.
* xtd/traits.hh: Rename as...
* xtd/optraits.hh: ...this; update.
* xtd/builtin/traits.hh: Update.
* tests/cos.cc: Update.
* tests/Makefile.am: Update.
* tests/math.cc: New.
* tests/cast.cc: Update.
tests/Makefile.am | 4 +
tests/cast.cc | 2
tests/cos.cc | 16 +++---
tests/math.cc | 14 +++++
xtd/builtin/traits.hh | 2
xtd/internal/opmacros.hh | 124 +++++++++++++++++++++++++++--------------------
xtd/math.hh | 60 +++++++++++++++++++---
xtd/math/abs.hh | 115 +++++++++++++++++++++++++++++++++++++++++++
xtd/math/acos.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/arith.hh | 104 ++-------------------------------------
xtd/math/asin.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/atan.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/atan2.hh | 94 +++++++++++++++++++++++++++++++++++
xtd/math/ceil.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/cmp.hh | 49 ++++++++++++++++++
xtd/math/constraints.hh | 63 +++++++++++++++++++++++
xtd/math/cos.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/cosh.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/exp.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/floor.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/id.hh | 3 -
xtd/math/includes.hh | 40 +++++++++++++++
xtd/math/log.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/log10.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/logic.hh | 48 ++++++++++++++++++
xtd/math/pow.hh | 109 +++++++++++++++++++++++++++++++++++++++++
xtd/math/sin.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/sinh.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/sqrt.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/tan.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/math/tanh.hh | 93 +++++++++++++++++++++++++++++++++++
xtd/optraits.hh | 6 +-
32 files changed, 2076 insertions(+), 172 deletions(-)
Index: xtd/math.hh
--- xtd/math.hh (revision 449)
+++ xtd/math.hh (working copy)
@@ -28,17 +28,61 @@
#ifndef EXTENDED_MATH_HH
# define EXTENDED_MATH_HH
-# include <cmath>
-# include <xtd/abstract/plain_fun.hh>
-# include <xtd/mfun.hh>
-# include <xtd/arg.hh>
-# include <xtd/ops_expr.hh>
-# include <xtd/math/id.hh>
-# include <xtd/math/trigo.hh>
+// FIXME: preconditions are not handled in code included below...
+
+
+
+/// \{
+/// Definition of xtd cmath-like functions.
+
+# include <xtd/math/abs.hh>
+# include <xtd/math/acos.hh>
+# include <xtd/math/asin.hh>
+# include <xtd/math/atan.hh>
+# include <xtd/math/atan2.hh>
+# include <xtd/math/ceil.hh>
+# include <xtd/math/cos.hh>
+# include <xtd/math/cosh.hh>
+# include <xtd/math/exp.hh>
+// 'fabs' is obsolete
+# include <xtd/math/floor.hh>
+// fmod
+// frexp
+// ldexp
+# include <xtd/math/log.hh>
+# include <xtd/math/log10.hh>
+// modf
+# include <xtd/math/pow.hh>
+# include <xtd/math/sin.hh>
+# include <xtd/math/sinh.hh>
+# include <xtd/math/sqrt.hh>
+# include <xtd/math/tan.hh>
+# include <xtd/math/tanh.hh>
+
+/// \}
+
+
+
+/// \{
+/// Definition of xtd operators and related functions.
+
# include <xtd/math/arith.hh>
-// # include <xtd/math/logic.hh>
+# include <xtd/math/logic.hh>
+# include <xtd/math/cmp.hh>
+
+/// \}
+
+
+
+/// \{
+/// Misc functions.
+
+# include <xtd/math/id.hh>
+
+/// \}
+
Index: xtd/math/log.hh
--- xtd/math/log.hh (revision 0)
+++ xtd/math/log.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_LOG_HH
+# define EXTENDED_MATH_LOG_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd (base-2) logarithm functions.
+
+
+ template <typename T> struct log_;
+
+ template <> struct constraints_< log_, float > {};
+ template <> struct constraints_< log_, double > {};
+ template <> struct constraints_< log_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< log_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct log_
+
+ : public abstract::plain_nary_fun_< 1, log_<T> >,
+
+ private constraints_< log_, T >
+ {
+ xtd_res(log_<T>) impl_op(const T& arg) const
+ {
+ return std::log(arg);
+ }
+ };
+
+
+ typedef m1fun_<log_> log_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::log_f : float -> float.
+ const log_<float> log_f;
+
+ /// \brief Plain function object xtd::log_d : double -> double.
+ const log_<double> log_d;
+
+ /// \brief Plain function object xtd::log_ld : long double -> long double.
+ const log_<long double> log_ld;
+
+ /// \brief Meta function object xtd::log.
+ const log_type log;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_LOG_HH
Index: xtd/math/floor.hh
--- xtd/math/floor.hh (revision 0)
+++ xtd/math/floor.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_FLOOR_HH
+# define EXTENDED_MATH_FLOOR_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd floor functions.
+
+
+ template <typename T> struct floor_;
+
+ template <> struct constraints_< floor_, float > {};
+ template <> struct constraints_< floor_, double > {};
+ template <> struct constraints_< floor_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< floor_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct floor_
+
+ : public abstract::plain_nary_fun_< 1, floor_<T> >,
+
+ private constraints_< floor_, T >
+ {
+ xtd_res(floor_<T>) impl_op(const T& arg) const
+ {
+ return std::floor(arg);
+ }
+ };
+
+
+ typedef m1fun_<floor_> floor_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::floor_f : float -> float.
+ const floor_<float> floor_f;
+
+ /// \brief Plain function object xtd::floor_d : double -> double.
+ const floor_<double> floor_d;
+
+ /// \brief Plain function object xtd::floor_ld : long double -> long double.
+ const floor_<long double> floor_ld;
+
+ /// \brief Meta function object xtd::floor.
+ const floor_type floor;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_FLOOR_HH
Index: xtd/math/log10.hh
--- xtd/math/log10.hh (revision 0)
+++ xtd/math/log10.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_LOG10_HH
+# define EXTENDED_MATH_LOG10_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd base-10 logarithm functions.
+
+
+ template <typename T> struct log10_;
+
+ template <> struct constraints_< log10_, float > {};
+ template <> struct constraints_< log10_, double > {};
+ template <> struct constraints_< log10_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< log10_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct log10_
+
+ : public abstract::plain_nary_fun_< 1, log10_<T> >,
+
+ private constraints_< log10_, T >
+ {
+ xtd_res(log10_<T>) impl_op(const T& arg) const
+ {
+ return std::log10(arg);
+ }
+ };
+
+
+ typedef m1fun_<log10_> log10_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::log10_f : float -> float.
+ const log10_<float> log10_f;
+
+ /// \brief Plain function object xtd::log10_d : double -> double.
+ const log10_<double> log10_d;
+
+ /// \brief Plain function object xtd::log10_ld : long double -> long double.
+ const log10_<long double> log10_ld;
+
+ /// \brief Meta function object xtd::log10.
+ const log10_type log10;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_LOG10_HH
Index: xtd/math/tan.hh
--- xtd/math/tan.hh (revision 0)
+++ xtd/math/tan.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_TAN_HH
+# define EXTENDED_MATH_TAN_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd tangent functions.
+
+
+ template <typename T> struct tan_;
+
+ template <> struct constraints_< tan_, float > {};
+ template <> struct constraints_< tan_, double > {};
+ template <> struct constraints_< tan_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< tan_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct tan_
+
+ : public abstract::plain_nary_fun_< 1, tan_<T> >,
+
+ private constraints_< tan_, T >
+ {
+ xtd_res(tan_<T>) impl_op(const T& arg) const
+ {
+ return std::tan(arg);
+ }
+ };
+
+
+ typedef m1fun_<tan_> tan_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::tan_f : float -> float.
+ const tan_<float> tan_f;
+
+ /// \brief Plain function object xtd::tan_d : double -> double.
+ const tan_<double> tan_d;
+
+ /// \brief Plain function object xtd::tan_ld : long double -> long double.
+ const tan_<long double> tan_ld;
+
+ /// \brief Meta function object xtd::tan.
+ const tan_type tan;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_TAN_HH
Index: xtd/math/atan.hh
--- xtd/math/atan.hh (revision 0)
+++ xtd/math/atan.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_ATAN_HH
+# define EXTENDED_MATH_ATAN_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd arc tangent functions.
+
+
+ template <typename T> struct atan_;
+
+ template <> struct constraints_< atan_, float > {};
+ template <> struct constraints_< atan_, double > {};
+ template <> struct constraints_< atan_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< atan_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct atan_
+
+ : public abstract::plain_nary_fun_< 1, atan_<T> >,
+
+ private constraints_< atan_, T >
+ {
+ xtd_res(atan_<T>) impl_op(const T& arg) const
+ {
+ return std::atan(arg);
+ }
+ };
+
+
+ typedef m1fun_<atan_> atan_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::atan_f : float -> float.
+ const atan_<float> atan_f;
+
+ /// \brief Plain function object xtd::atan_d : double -> double.
+ const atan_<double> atan_d;
+
+ /// \brief Plain function object xtd::atan_ld : long double -> long double.
+ const atan_<long double> atan_ld;
+
+ /// \brief Meta function object xtd::atan.
+ const atan_type atan;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ATAN_HH
Index: xtd/math/cos.hh
--- xtd/math/cos.hh (revision 0)
+++ xtd/math/cos.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_COS_HH
+# define EXTENDED_MATH_COS_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd cosine functions.
+
+
+ template <typename T> struct cos_;
+
+ template <> struct constraints_< cos_, float > {};
+ template <> struct constraints_< cos_, double > {};
+ template <> struct constraints_< cos_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< cos_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct cos_
+
+ : public abstract::plain_nary_fun_< 1, cos_<T> >,
+
+ private constraints_< cos_, T >
+ {
+ xtd_res(cos_<T>) impl_op(const T& arg) const
+ {
+ return std::cos(arg);
+ }
+ };
+
+
+ typedef m1fun_<cos_> cos_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::cos_f : float -> float.
+ const cos_<float> cos_f;
+
+ /// \brief Plain function object xtd::cos_d : double -> double.
+ const cos_<double> cos_d;
+
+ /// \brief Plain function object xtd::cos_ld : long double -> long double.
+ const cos_<long double> cos_ld;
+
+ /// \brief Meta function object xtd::cos.
+ const cos_type cos;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_COS_HH
Index: xtd/math/acos.hh
--- xtd/math/acos.hh (revision 0)
+++ xtd/math/acos.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_ACOS_HH
+# define EXTENDED_MATH_ACOS_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd arc cosine functions.
+
+
+ template <typename T> struct acos_;
+
+ template <> struct constraints_< acos_, float > {};
+ template <> struct constraints_< acos_, double > {};
+ template <> struct constraints_< acos_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< acos_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct acos_
+
+ : public abstract::plain_nary_fun_< 1, acos_<T> >,
+
+ private constraints_< acos_, T >
+ {
+ xtd_res(acos_<T>) impl_op(const T& arg) const
+ {
+ return std::acos(arg);
+ }
+ };
+
+
+ typedef m1fun_<acos_> acos_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::acos_f : float -> float.
+ const acos_<float> acos_f;
+
+ /// \brief Plain function object xtd::acos_d : double -> double.
+ const acos_<double> acos_d;
+
+ /// \brief Plain function object xtd::acos_ld : long double -> long double.
+ const acos_<long double> acos_ld;
+
+ /// \brief Meta function object xtd::acos.
+ const acos_type acos;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ACOS_HH
Index: xtd/math/sin.hh
--- xtd/math/sin.hh (revision 0)
+++ xtd/math/sin.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_SIN_HH
+# define EXTENDED_MATH_SIN_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd sine functions.
+
+
+ template <typename T> struct sin_;
+
+ template <> struct constraints_< sin_, float > {};
+ template <> struct constraints_< sin_, double > {};
+ template <> struct constraints_< sin_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< sin_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct sin_
+
+ : public abstract::plain_nary_fun_< 1, sin_<T> >,
+
+ private constraints_< sin_, T >
+ {
+ xtd_res(sin_<T>) impl_op(const T& arg) const
+ {
+ return std::sin(arg);
+ }
+ };
+
+
+ typedef m1fun_<sin_> sin_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::sin_f : float -> float.
+ const sin_<float> sin_f;
+
+ /// \brief Plain function object xtd::sin_d : double -> double.
+ const sin_<double> sin_d;
+
+ /// \brief Plain function object xtd::sin_ld : long double -> long double.
+ const sin_<long double> sin_ld;
+
+ /// \brief Meta function object xtd::sin.
+ const sin_type sin;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_SIN_HH
Index: xtd/math/sqrt.hh
--- xtd/math/sqrt.hh (revision 0)
+++ xtd/math/sqrt.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_SQRT_HH
+# define EXTENDED_MATH_SQRT_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd square root functions.
+
+
+ template <typename T> struct sqrt_;
+
+ template <> struct constraints_< sqrt_, float > {};
+ template <> struct constraints_< sqrt_, double > {};
+ template <> struct constraints_< sqrt_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< sqrt_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct sqrt_
+
+ : public abstract::plain_nary_fun_< 1, sqrt_<T> >,
+
+ private constraints_< sqrt_, T >
+ {
+ xtd_res(sqrt_<T>) impl_op(const T& arg) const
+ {
+ return std::sqrt(arg);
+ }
+ };
+
+
+ typedef m1fun_<sqrt_> sqrt_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::sqrt_f : float -> float.
+ const sqrt_<float> sqrt_f;
+
+ /// \brief Plain function object xtd::sqrt_d : double -> double.
+ const sqrt_<double> sqrt_d;
+
+ /// \brief Plain function object xtd::sqrt_ld : long double -> long double.
+ const sqrt_<long double> sqrt_ld;
+
+ /// \brief Meta function object xtd::sqrt.
+ const sqrt_type sqrt;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_SQRT_HH
Index: xtd/math/asin.hh
--- xtd/math/asin.hh (revision 0)
+++ xtd/math/asin.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_ASIN_HH
+# define EXTENDED_MATH_ASIN_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd arc sine functions.
+
+
+ template <typename T> struct asin_;
+
+ template <> struct constraints_< asin_, float > {};
+ template <> struct constraints_< asin_, double > {};
+ template <> struct constraints_< asin_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< asin_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct asin_
+
+ : public abstract::plain_nary_fun_< 1, asin_<T> >,
+
+ private constraints_< asin_, T >
+ {
+ xtd_res(asin_<T>) impl_op(const T& arg) const
+ {
+ return std::asin(arg);
+ }
+ };
+
+
+ typedef m1fun_<asin_> asin_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::asin_f : float -> float.
+ const asin_<float> asin_f;
+
+ /// \brief Plain function object xtd::asin_d : double -> double.
+ const asin_<double> asin_d;
+
+ /// \brief Plain function object xtd::asin_ld : long double -> long double.
+ const asin_<long double> asin_ld;
+
+ /// \brief Meta function object xtd::asin.
+ const asin_type asin;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ASIN_HH
Index: xtd/math/tanh.hh
--- xtd/math/tanh.hh (revision 0)
+++ xtd/math/tanh.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_TANH_HH
+# define EXTENDED_MATH_TANH_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd hyperbolic tangent functions.
+
+
+ template <typename T> struct tanh_;
+
+ template <> struct constraints_< tanh_, float > {};
+ template <> struct constraints_< tanh_, double > {};
+ template <> struct constraints_< tanh_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< tanh_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct tanh_
+
+ : public abstract::plain_nary_fun_< 1, tanh_<T> >,
+
+ private constraints_< tanh_, T >
+ {
+ xtd_res(tanh_<T>) impl_op(const T& arg) const
+ {
+ return std::tanh(arg);
+ }
+ };
+
+
+ typedef m1fun_<tanh_> tanh_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::tanh_f : float -> float.
+ const tanh_<float> tanh_f;
+
+ /// \brief Plain function object xtd::tanh_d : double -> double.
+ const tanh_<double> tanh_d;
+
+ /// \brief Plain function object xtd::tanh_ld : long double -> long double.
+ const tanh_<long double> tanh_ld;
+
+ /// \brief Meta function object xtd::tanh.
+ const tanh_type tanh;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_TANH_HH
Index: xtd/math/exp.hh
--- xtd/math/exp.hh (revision 0)
+++ xtd/math/exp.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_EXP_HH
+# define EXTENDED_MATH_EXP_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd exponential functions.
+
+
+ template <typename T> struct exp_;
+
+ template <> struct constraints_< exp_, float > {};
+ template <> struct constraints_< exp_, double > {};
+ template <> struct constraints_< exp_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< exp_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct exp_
+
+ : public abstract::plain_nary_fun_< 1, exp_<T> >,
+
+ private constraints_< exp_, T >
+ {
+ xtd_res(exp_<T>) impl_op(const T& arg) const
+ {
+ return std::exp(arg);
+ }
+ };
+
+
+ typedef m1fun_<exp_> exp_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::exp_f : float -> float.
+ const exp_<float> exp_f;
+
+ /// \brief Plain function object xtd::exp_d : double -> double.
+ const exp_<double> exp_d;
+
+ /// \brief Plain function object xtd::exp_ld : long double -> long double.
+ const exp_<long double> exp_ld;
+
+ /// \brief Meta function object xtd::exp.
+ const exp_type exp;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_EXP_HH
Index: xtd/math/cosh.hh
--- xtd/math/cosh.hh (revision 0)
+++ xtd/math/cosh.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_COSH_HH
+# define EXTENDED_MATH_COSH_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd hyperbolic cosine functions.
+
+
+ template <typename T> struct cosh_;
+
+ template <> struct constraints_< cosh_, float > {};
+ template <> struct constraints_< cosh_, double > {};
+ template <> struct constraints_< cosh_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< cosh_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct cosh_
+
+ : public abstract::plain_nary_fun_< 1, cosh_<T> >,
+
+ private constraints_< cosh_, T >
+ {
+ xtd_res(cosh_<T>) impl_op(const T& arg) const
+ {
+ return std::cosh(arg);
+ }
+ };
+
+
+ typedef m1fun_<cosh_> cosh_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::cosh_f : float -> float.
+ const cosh_<float> cosh_f;
+
+ /// \brief Plain function object xtd::cosh_d : double -> double.
+ const cosh_<double> cosh_d;
+
+ /// \brief Plain function object xtd::cosh_ld : long double -> long double.
+ const cosh_<long double> cosh_ld;
+
+ /// \brief Meta function object xtd::cosh.
+ const cosh_type cosh;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_COSH_HH
Index: xtd/math/id.hh
--- xtd/math/id.hh (revision 449)
+++ xtd/math/id.hh (working copy)
@@ -28,8 +28,7 @@
#ifndef EXTENDED_MATH_ID_HH
# define EXTENDED_MATH_ID_HH
-# include <xtd/abstract/plain_nary_fun.hh>
-# include <xtd/mfun.hh>
+# include <xtd/math/includes.hh>
namespace xtd
Index: xtd/math/logic.hh
--- xtd/math/logic.hh (revision 0)
+++ xtd/math/logic.hh (revision 0)
@@ -0,0 +1,48 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_LOGIC_HH
+# define EXTENDED_MATH_LOGIC_HH
+
+# include <xtd/internal/opmacros.hh>
+
+
+namespace xtd
+{
+
+ xtd_internal_decl_binary_operator( land, and );
+ xtd_internal_decl_binary_operator( lor, or );
+ xtd_internal_decl_binary_operator( lxor, xor );
+
+ xtd_internal_decl_unary_operator( lnot, not );
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_LOGIC_HH
Index: xtd/math/sinh.hh
--- xtd/math/sinh.hh (revision 0)
+++ xtd/math/sinh.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_SINH_HH
+# define EXTENDED_MATH_SINH_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd hyperbolic sine functions.
+
+
+ template <typename T> struct sinh_;
+
+ template <> struct constraints_< sinh_, float > {};
+ template <> struct constraints_< sinh_, double > {};
+ template <> struct constraints_< sinh_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< sinh_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct sinh_
+
+ : public abstract::plain_nary_fun_< 1, sinh_<T> >,
+
+ private constraints_< sinh_, T >
+ {
+ xtd_res(sinh_<T>) impl_op(const T& arg) const
+ {
+ return std::sinh(arg);
+ }
+ };
+
+
+ typedef m1fun_<sinh_> sinh_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::sinh_f : float -> float.
+ const sinh_<float> sinh_f;
+
+ /// \brief Plain function object xtd::sinh_d : double -> double.
+ const sinh_<double> sinh_d;
+
+ /// \brief Plain function object xtd::sinh_ld : long double -> long double.
+ const sinh_<long double> sinh_ld;
+
+ /// \brief Meta function object xtd::sinh.
+ const sinh_type sinh;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_SINH_HH
Index: xtd/math/atan2.hh
--- xtd/math/atan2.hh (revision 0)
+++ xtd/math/atan2.hh (revision 0)
@@ -0,0 +1,94 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_ATAN2_HH
+# define EXTENDED_MATH_ATAN2_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd arc tangent functions taking two arguments.
+
+
+ template <typename T1, typename T2> struct atan2_;
+
+ template <> struct constraints_2_< atan2_, float, float > {};
+ template <> struct constraints_2_< atan2_, double, double > {};
+ template <> struct constraints_2_< atan2_, long double, long double > {};
+
+ template <typename T>
+ struct fun_traits_< atan2_<T, T> >
+ {
+ typedef T arg1_type;
+ typedef T arg2_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T1, typename T2>
+ struct atan2_
+
+ : public abstract::plain_nary_fun_< 2, atan2_<T1, T2> >,
+
+ private constraints_2_< atan2_, T1, T2 >
+ {
+ xtd_res(mlc_comma_1(atan2_<T1,T2>)) impl_op(const T1& arg1, const T2& arg2) const
+ {
+ return std::atan2(arg1, arg2);
+ }
+ };
+
+
+ typedef m2fun_<atan2_> atan2_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::atan2_f : (float, float) -> float.
+ const atan2_<float, float> atan2_f;
+
+ /// \brief Plain function object xtd::atan2_d : (double, double) -> double.
+ const atan2_<double, double> atan2_d;
+
+ /// \brief Plain function object xtd::atan2_ld : (long double, long double) -> long double.
+ const atan2_<long double, long double> atan2_ld;
+
+ /// \brief Meta function object xtd::atan2.
+ const atan2_type atan2;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ATAN2_HH
Index: xtd/math/abs.hh
--- xtd/math/abs.hh (revision 0)
+++ xtd/math/abs.hh (revision 0)
@@ -0,0 +1,115 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_ABS_HH
+# define EXTENDED_MATH_ABS_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd absolute value functions.
+
+
+ template <typename T> struct abs_;
+
+ template <> struct constraints_< abs_, int > {};
+ template <> struct constraints_< abs_, long int > {};
+
+ template <> struct constraints_< abs_, float > {};
+ template <> struct constraints_< abs_, double > {};
+ template <> struct constraints_< abs_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< abs_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+ namespace internal {
+
+ int abs_(int i) { return std::abs(i); }
+ long int abs_(long int i) { return std::abs(i); }
+
+ float abs_(float i) { return std::fabs(i); }
+ double abs_(double i) { return std::fabs(i); }
+ long double abs_(long double i) { return std::fabs(i); }
+
+ } // end of namespace xtd::internal
+
+
+ template <typename T>
+ struct abs_
+
+ : public abstract::plain_nary_fun_< 1, abs_<T> >,
+
+ private constraints_< abs_, T >
+ {
+ xtd_res(abs_<T>) impl_op(const T& arg) const
+ {
+ return internal::abs_(arg);
+ }
+ };
+
+
+ typedef m1fun_<abs_> abs_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::abs_f : int -> int.
+ const abs_<int> abs_i;
+
+ /// \brief Plain function object xtd::abs_d : long int -> long int.
+ const abs_<long int> abs_li;
+
+
+ /// \brief Plain function object xtd::abs_f : float -> float.
+ const abs_<float> abs_f;
+
+ /// \brief Plain function object xtd::abs_d : double -> double.
+ const abs_<double> abs_d;
+
+ /// \brief Plain function object xtd::abs_ld : long double -> long double.
+ const abs_<long double> abs_ld;
+
+
+ /// \brief Meta function object xtd::abs.
+ const abs_type abs;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_ABS_HH
Index: xtd/math/pow.hh
--- xtd/math/pow.hh (revision 0)
+++ xtd/math/pow.hh (revision 0)
@@ -0,0 +1,109 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_POW_HH
+# define EXTENDED_MATH_POW_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd arc tangent functions taking two arguments.
+
+
+ template <typename T1, typename T2> struct pow_;
+
+ template <> struct constraints_2_< pow_, float, float > {};
+ template <> struct constraints_2_< pow_, double, double > {};
+ template <> struct constraints_2_< pow_, long double, long double > {};
+
+ template <> struct constraints_2_< pow_, float, int > {};
+ template <> struct constraints_2_< pow_, double, int > {};
+ template <> struct constraints_2_< pow_, long double, int > {};
+
+ template <typename T1, typename T2>
+ struct fun_traits_< pow_<T1, T2> >
+ {
+ typedef T1 arg1_type;
+ typedef T2 arg2_type;
+ typedef T1 res_type;
+ };
+
+
+ template <typename T1, typename T2>
+ struct pow_
+
+ : public abstract::plain_nary_fun_< 2, pow_<T1, T2> >,
+
+ private constraints_2_< pow_, T1, T2 >
+ {
+ xtd_res(mlc_comma_1(pow_<T1,T2>)) impl_op(const T1& arg1, const T2& arg2) const
+ {
+ return std::pow(arg1, arg2);
+ }
+ };
+
+
+ typedef m2fun_<pow_> pow_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::pow_f : (float, float) -> float.
+ const pow_<float, float> pow_f;
+
+ /// \brief Plain function object xtd::pow_d : (double, double) -> double.
+ const pow_<double, double> pow_d;
+
+ /// \brief Plain function object xtd::pow_ld : (long double, long double) -> long double.
+ const pow_<long double, long double> pow_ld;
+
+
+ /// \brief Plain function object xtd::pow_f : (float, int) -> float.
+ const pow_<float, int> pow_fi;
+
+ /// \brief Plain function object xtd::pow_d : (double, int) -> double.
+ const pow_<double, int> pow_di;
+
+ /// \brief Plain function object xtd::pow_ld : (long double, int) -> long double.
+ const pow_<long double, int> pow_ldi;
+
+
+ /// \brief Meta function object xtd::pow.
+ const pow_type pow;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_POW_HH
Index: xtd/math/includes.hh
--- xtd/math/includes.hh (revision 0)
+++ xtd/math/includes.hh (revision 0)
@@ -0,0 +1,40 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_INCLUDES_HH
+# define EXTENDED_MATH_INCLUDES_HH
+
+
+# include <cmath>
+# include <cassert>
+
+# include <xtd/abstract/plain_nary_fun.hh>
+# include <xtd/mfun.hh>
+# include <xtd/math/constraints.hh>
+
+
+#endif // ! EXTENDED_MATH_INCLUDES_HH
Index: xtd/math/arith.hh
--- xtd/math/arith.hh (revision 449)
+++ xtd/math/arith.hh (working copy)
@@ -28,109 +28,19 @@
#ifndef EXTENDED_MATH_ARITH_HH
# define EXTENDED_MATH_ARITH_HH
-# include <xtd/builtin/traits.hh>
-# include <xtd/abstract/plain_nary_fun.hh>
-# include <xtd/mfun.hh>
-
-
-// FIXME: doc
-
-# define xtd_internal_decl_plain_unary_fun_op(OperatorName, OperatorSymbol) \
- \
- template <typename T> \
- struct plain_##OperatorName##_; \
- \
- template <typename T> \
- struct fun_traits_< plain_##OperatorName##_<T> > \
- { \
- typedef T arg_type; \
- typedef xtd_##OperatorName(T) res_type; \
- }; \
- \
- template <typename T> \
- struct plain_##OperatorName##_ \
- \
- : public abstract::plain_nary_fun_< 1, plain_##OperatorName##_<T> > \
- { \
- typedef plain_##OperatorName##_<T> self; \
- xtd_res(self) impl_op(const T& arg) const \
- { \
- return OperatorSymbol arg; \
- } \
- }; \
- \
- typedef m1fun_<plain_##OperatorName##_> OperatorName##_type; \
- const OperatorName##_type OperatorName; \
- \
- struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
-
-
-
-
-# define xtd_internal_decl_plain_binary_fun_op(OperatorName, OperatorSymbol) \
- \
- template <typename T1, typename T2> \
- struct plain_##OperatorName##_; \
- \
- template <typename T1, typename T2> \
- struct fun_traits_< plain_##OperatorName##_<T1, T2> > \
- { \
- typedef T1 arg1_type; \
- typedef T2 arg2_type; \
- typedef xtd_##OperatorName(T1, T2) res_type; \
- }; \
- \
- template <typename T1, typename T2> \
- struct plain_##OperatorName##_ \
- \
- : public abstract::plain_nary_fun_< 2, plain_##OperatorName##_<T1, T2> > \
- { \
- typedef plain_##OperatorName##_<T1, T2> self; \
- xtd_res(self) impl_op(const T1& arg1, const T2& arg2) const \
- { \
- return arg1 OperatorSymbol arg2; \
- } \
- }; \
- \
- typedef m2fun_<plain_##OperatorName##_> OperatorName##_type; \
- const OperatorName##_type OperatorName; \
- \
- struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
-
-
+# include <xtd/internal/opmacros.hh>
namespace xtd
{
- // logic
-
- xtd_internal_decl_plain_binary_fun_op( land, and );
- xtd_internal_decl_plain_binary_fun_op( lor, or );
- xtd_internal_decl_plain_binary_fun_op( lxor, xor );
-
- xtd_internal_decl_plain_unary_fun_op( lnot, not );
-
-
- // cmp
-
- xtd_internal_decl_plain_binary_fun_op( eq, == );
- xtd_internal_decl_plain_binary_fun_op( neq, != );
- xtd_internal_decl_plain_binary_fun_op( less, < );
- xtd_internal_decl_plain_binary_fun_op( leq, <= );
- xtd_internal_decl_plain_binary_fun_op( greater, > );
- xtd_internal_decl_plain_binary_fun_op( geq, >= );
-
-
- // arith
-
- xtd_internal_decl_plain_binary_fun_op( plus, + );
- xtd_internal_decl_plain_binary_fun_op( minus, - );
- xtd_internal_decl_plain_binary_fun_op( mult, * );
- xtd_internal_decl_plain_binary_fun_op( div, / );
- xtd_internal_decl_plain_binary_fun_op( mod, % );
+ xtd_internal_decl_binary_operator( plus, + );
+ xtd_internal_decl_binary_operator( minus, - );
+ xtd_internal_decl_binary_operator( mult, * );
+ xtd_internal_decl_binary_operator( div, / );
+ xtd_internal_decl_binary_operator( mod, % );
- xtd_internal_decl_plain_unary_fun_op( uminus, - );
+ xtd_internal_decl_unary_operator( uminus, - );
} // end of namespace xtd
Index: xtd/math/constraints.hh
--- xtd/math/constraints.hh (revision 0)
+++ xtd/math/constraints.hh (revision 0)
@@ -0,0 +1,63 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_CONSTRAINTS_HH
+# define EXTENDED_MATH_CONSTRAINTS_HH
+
+# include <mlc/abort.hh>
+
+
+namespace xtd
+{
+
+ namespace ERROR
+ {
+ struct FIXME;
+
+ } // end of namespace xtd::ERROR
+
+
+ template < template<typename> class pfun,
+ typename T >
+ struct constraints_ : private mlc::abort_< ERROR::FIXME >
+ {
+ };
+
+
+ template < template<typename, typename> class pfun,
+ typename T1,
+ typename T2 >
+ struct constraints_2_ : private mlc::abort_< ERROR::FIXME >
+ {
+ };
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_CONSTRAINTS_HH
Index: xtd/math/ceil.hh
--- xtd/math/ceil.hh (revision 0)
+++ xtd/math/ceil.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_CEIL_HH
+# define EXTENDED_MATH_CEIL_HH
+
+# include <xtd/math/includes.hh>
+
+
+namespace xtd
+{
+
+ /// \{
+ /// Definition of xtd ceil functions.
+
+
+ template <typename T> struct ceil_;
+
+ template <> struct constraints_< ceil_, float > {};
+ template <> struct constraints_< ceil_, double > {};
+ template <> struct constraints_< ceil_, long double > {};
+
+ template <typename T>
+ struct fun_traits_< ceil_<T> >
+ {
+ typedef T arg_type;
+ typedef T res_type;
+ };
+
+
+ template <typename T>
+ struct ceil_
+
+ : public abstract::plain_nary_fun_< 1, ceil_<T> >,
+
+ private constraints_< ceil_, T >
+ {
+ xtd_res(ceil_<T>) impl_op(const T& arg) const
+ {
+ return std::ceil(arg);
+ }
+ };
+
+
+ typedef m1fun_<ceil_> ceil_type;
+
+
+ /// \}
+
+
+
+ /// \brief Plain function object xtd::ceil_f : float -> float.
+ const ceil_<float> ceil_f;
+
+ /// \brief Plain function object xtd::ceil_d : double -> double.
+ const ceil_<double> ceil_d;
+
+ /// \brief Plain function object xtd::ceil_ld : long double -> long double.
+ const ceil_<long double> ceil_ld;
+
+ /// \brief Meta function object xtd::ceil.
+ const ceil_type ceil;
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_CEIL_HH
Index: xtd/math/cmp.hh
--- xtd/math/cmp.hh (revision 0)
+++ xtd/math/cmp.hh (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (C) 2002, 2005, 2006 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, 59 Temple Place - Suite 330, 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 EXTENDED_MATH_CMP_HH
+# define EXTENDED_MATH_CMP_HH
+
+# include <xtd/internal/opmacros.hh>
+
+
+namespace xtd
+{
+
+ xtd_internal_decl_binary_operator( eq, == );
+ xtd_internal_decl_binary_operator( neq, != );
+ xtd_internal_decl_binary_operator( less, < );
+ xtd_internal_decl_binary_operator( leq, <= );
+ xtd_internal_decl_binary_operator( greater, > );
+ xtd_internal_decl_binary_operator( geq, >= );
+
+
+} // end of namespace xtd
+
+
+
+#endif // ! EXTENDED_MATH_CMP_HH
Index: xtd/optraits.hh
--- xtd/optraits.hh (revision 443)
+++ xtd/optraits.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef EXTENDED_TRAITS_HH
-# define EXTENDED_TRAITS_HH
+#ifndef EXTENDED_OPTRAITS_HH
+# define EXTENDED_OPTRAITS_HH
# include <mlc/flags.hh>
@@ -165,4 +165,4 @@
-#endif // ! EXTENDED_TRAITS_HH
+#endif // ! EXTENDED_OPTRAITS_HH
Index: xtd/builtin/traits.hh
--- xtd/builtin/traits.hh (revision 449)
+++ xtd/builtin/traits.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef EXTENDED_BUILTIN_TRAITS_HH
# define EXTENDED_BUILTIN_TRAITS_HH
-# include <xtd/traits.hh>
+# include <xtd/optraits.hh>
Index: xtd/internal/opmacros.hh
--- xtd/internal/opmacros.hh (revision 443)
+++ xtd/internal/opmacros.hh (working copy)
@@ -25,22 +25,51 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef EXTENDED_OPS_EXPR_HH
-# define EXTENDED_OPS_EXPR_HH
+#ifndef EXTENDED_INTERNAL_OPMACROS_HH
+# define EXTENDED_INTERNAL_OPMACROS_HH
+
+# include <xtd/math/includes.hh>
# include <xtd/abstract/fun_expr.hh>
# include <xtd/mexpr.hh>
-# include <xtd/math/arith.hh>
-
-
-
+# include <xtd/literal.hh>
-// FIXME: doc
+# include <xtd/optraits.hh>
+# include <xtd/builtin/traits.hh>
# define xtd_internal_decl_unary_operator(OperatorName, OperatorSymbol) \
\
+ \
+ template <typename T> \
+ struct plain_##OperatorName##_; \
+ \
+ template <typename T> \
+ struct fun_traits_< plain_##OperatorName##_<T> > \
+ { \
+ typedef T arg_type; \
+ typedef xtd_##OperatorName(T) res_type; \
+ }; \
+ \
+ \
+ template <typename T> \
+ struct plain_##OperatorName##_ \
+ \
+ : public abstract::plain_nary_fun_< 1, plain_##OperatorName##_<T> > \
+ { \
+ typedef plain_##OperatorName##_<T> self; \
+ xtd_res(self) impl_op(const T& arg) const \
+ { \
+ return OperatorSymbol arg; \
+ } \
+ }; \
+ \
+ \
+ typedef m1fun_<plain_##OperatorName##_> OperatorName##_type; \
+ const OperatorName##_type OperatorName; \
+ \
+ \
template <typename Expr> \
xtd::m1expr_<xtd::OperatorName##_type, Expr> \
operator OperatorSymbol (const xtd::abstract::fun_expr_<Expr>& expr) \
@@ -49,10 +78,11 @@
return tmp; \
} \
\
- struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
+ \
+ struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n \
-// FIXME: add something like:
+// FIXME: does not specialize any template arguments
// template <typename Expr>
// struct OperatorName##_trait_ < Expr >
@@ -62,9 +92,38 @@
-
# define xtd_internal_decl_binary_operator(OperatorName, OperatorSymbol) \
\
+ \
+ template <typename T1, typename T2> \
+ struct plain_##OperatorName##_; \
+ \
+ template <typename T1, typename T2> \
+ struct fun_traits_< plain_##OperatorName##_<T1, T2> > \
+ { \
+ typedef T1 arg1_type; \
+ typedef T2 arg2_type; \
+ typedef xtd_##OperatorName(T1, T2) res_type; \
+ }; \
+ \
+ \
+ template <typename T1, typename T2> \
+ struct plain_##OperatorName##_ \
+ \
+ : public abstract::plain_nary_fun_< 2, plain_##OperatorName##_<T1, T2> > \
+ { \
+ typedef plain_##OperatorName##_<T1, T2> self; \
+ xtd_res(self) impl_op(const T1& arg1, const T2& arg2) const \
+ { \
+ return arg1 OperatorSymbol arg2; \
+ } \
+ }; \
+ \
+ \
+ typedef m2fun_<plain_##OperatorName##_> OperatorName##_type; \
+ const OperatorName##_type OperatorName; \
+ \
+ \
template <typename Lexpr, typename Rexpr> \
xtd::m2expr_<xtd::OperatorName##_type, Lexpr, Rexpr> \
operator OperatorSymbol (const xtd::abstract::fun_expr_<Lexpr>& lexpr, \
@@ -74,10 +133,11 @@
return tmp; \
} \
\
- struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n
+ \
+ struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n \
-// FIXME: add something like:
+// FIXME: does not specialize any template arguments
// template <typename Lexpr, typename Rexpr>
// struct OperatorName##_trait_ < Lexpr, Rexpr >
@@ -86,42 +146,4 @@
// };
-
-
-
-namespace xtd
-{
-
- // logic
-
- xtd_internal_decl_binary_operator( land, and );
- xtd_internal_decl_binary_operator( lor, or );
- xtd_internal_decl_binary_operator( lxor, xor );
-
- xtd_internal_decl_unary_operator( lnot, not );
-
-
- // cmp
-
- xtd_internal_decl_binary_operator( eq, == );
- xtd_internal_decl_binary_operator( neq, != );
- xtd_internal_decl_binary_operator( less, < );
- xtd_internal_decl_binary_operator( leq, <= );
- xtd_internal_decl_binary_operator( greater, > );
- xtd_internal_decl_binary_operator( geq, >= );
-
-
- // arith
-
- xtd_internal_decl_binary_operator( plus, + );
- xtd_internal_decl_binary_operator( minus, - );
- xtd_internal_decl_binary_operator( mult, * );
- xtd_internal_decl_binary_operator( div, / );
- xtd_internal_decl_binary_operator( mod, % );
-
- xtd_internal_decl_unary_operator( uminus, - );
-
-} // end of namespace xtd
-
-
-#endif // ! EXTENDED_OPS_EXPR_HH
+#endif // ! EXTENDED_INTERNAL_OPMACROS_HH
Index: tests/cos.cc
--- tests/cos.cc (revision 449)
+++ tests/cos.cc (working copy)
@@ -1,6 +1,6 @@
#include <iostream>
-#include <xtd/math.hh>
+#include <xtd/math/cos.hh>
int main()
@@ -29,11 +29,11 @@
// std::cout << (cos(_1)(_2)).nargs() << std::endl; // gives: 2
// }
- {
- using xtd::cos;
- using xtd::sin;
- using xtd::_1;
- using xtd::_2;
+// {
+// using xtd::cos;
+// using xtd::sin;
+// using xtd::_1;
+// using xtd::_2;
// std::cout << (cos(_1) * cos(_1) + sin(_2) * sin(_2))(5.f, 5.f) << std::endl;
@@ -44,9 +44,9 @@
// (cos(_1) + sin(_1))(_1);
// std::cout << (cos(_1) * cos(_1) + sin(_1) * sin(_1))(_1)(51.f) << std::endl;
- std::cout << (_1 * _1 + _2 * _2)(cos(_1), sin(_1))(51.f) << std::endl;
+// std::cout << (_1 * _1 + _2 * _2)(cos(_1), sin(_1))(51.f) << std::endl;
// std::cout << ((cos(_1) + sin(_2))(_1, _1)).nargs() << std::endl;
- }
+// }
}
Index: tests/Makefile.am
--- tests/Makefile.am (revision 449)
+++ tests/Makefile.am (working copy)
@@ -13,7 +13,8 @@
cast \
cfun \
cos \
- lit
+ lit \
+ math
id_SOURCES = id.cc
bind_SOURCES = bind.cc
@@ -21,5 +22,6 @@
cfun_SOURCES = cfun.cc
cos_SOURCES = cos.cc
lit_SOURCES = lit.cc
+math_SOURCES = math.cc
TESTS = $(check_PROGRAMS)
Index: tests/math.cc
--- tests/math.cc (revision 0)
+++ tests/math.cc (revision 0)
@@ -0,0 +1,14 @@
+#include <iostream>
+#include <xtd/math.hh>
+
+
+int main()
+{
+ using xtd::cos;
+ using xtd::sin;
+ using xtd::_1;
+ using xtd::_2;
+
+ std::cout << (cos(_1) * cos(_1) + sin(_2) * sin(_2))(_1, _1)(51.f) << std::endl;
+ std::cout << (_1 * _1 + _2 * _2)(cos(_1), sin(_1))(51.f) << std::endl;
+}
Index: tests/cast.cc
--- tests/cast.cc (revision 449)
+++ tests/cast.cc (working copy)
@@ -1,7 +1,7 @@
#include <iostream>
#include <xtd/cast.hh>
#include <xtd/arg.hh>
-#include <xtd/math/trigo.hh>
+#include <xtd/math/cos.hh>
int main()