Commit 60ffc4dc authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Make the use of pw::cst() optional in predicates.

	* mln/pw/cst.hh: add the proper traits.

	* tests/pw/value.cc: add one more test.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3171 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent a34e9169
2009-01-20 Guillaume Lazzara <z@lrde.epita.fr>
Make the use of pw::cst() optional in predicates.
* mln/pw/cst.hh: add the proper traits.
* tests/pw/value.cc: add one more test.
2009-01-20 Guillaume Lazzara <z@lrde.epita.fr>
 
Fix a double free in fibonacci heap and add support for priority.
......@@ -39,6 +39,40 @@
namespace mln
{
// Forward declaration
namespace pw
{
template <typename T>
struct cst_;
template <typename T>
cst_<T> cst(const T& t);
} // end of namespace mln::pw
namespace trait
{
template <typename F, typename S>
struct set_binary_< op::eq, mln::Function_v2v, F, mln::value::Scalar, S >
{
typedef mln_trait_op_eq(F, pw::cst_<mln_value_equiv(S)>) ret;
};
} // end of namespace mln::trait
template <typename F, typename S>
mln_trait_op_eq(F,S)
operator == (const Function_v2v<F>& fun, const value::Scalar<S>& s)
{
return exact(fun) == pw::cst( value::equiv(s) );
}
namespace pw
{
......
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -25,10 +26,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
/*! \file tests/pw/value.cc
*
* \brief Test on mln::pw::value_.
*/
/// \file tests/pw/value.cc
///
/// Test on mln::pw::value_.
#include <mln/core/image/image2d.hh>
#include <mln/data/fill.hh>
......@@ -45,6 +45,7 @@ int main()
point2d p(1, 1);
ima(p) = 51;
mln_assertion( (pw::value(ima) == pw::cst(51))(p) == true );
mln_assertion( (pw::value(ima) == 51)(p) == true );
// {
// image2d<float> imaf(3,3);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment