26 #ifndef MLN_WIN_DIFF_HH
27 # define MLN_WIN_DIFF_HH
33 # include <mln/trait/op/minus.hh>
34 # include <mln/core/window.hh>
35 # include <mln/core/neighb.hh>
48 template <
typename W1,
typename W2>
50 diff(const Window<W1>& win1, const Window<W2>& win2);
56 template <typename N1, typename N2>
57 neighb<mln_deduce(N1, window, regular)>
58 diff(const Neighborhood<N1>& nbh1, const Neighborhood<N2>& nbh2);
67 template <typename W1, typename W2>
69 operator-(const Window<W1>& win1, const Window<W2>& win2);
74 template <typename N1, typename N2>
75 neighb<mln_deduce(N1, window, regular)>
76 operator-(const Neighborhood<N1>& nbh1, const Neighborhood<N2>& nbh2);
82 template <
typename W1,
typename W2>
89 template <typename N1, typename N2>
90 struct set_binary_< op::minus, mln::Neighborhood, N1, mln::Neighborhood, N2 >
99 # ifndef MLN_INCLUDE_ONLY
104 template <
typename W1,
typename W2>
107 diff(const Window<W1>& win1_, const Window<W2>& win2_)
109 trace::entering(
"win::diff");
111 mln_is_simple_window(W1)::check();
112 mln_is_simple_window(W2)::check();
114 const W1& win1 = exact(win1_);
115 const W2& win2 = exact(win2_);
118 const
unsigned n = win1.size();
119 for (
unsigned i = 0; i < n; ++i)
121 if (win2.has(win1.dp(i)))
123 tmp.insert(win1.dp(i));
126 trace::exiting(
"win::diff");
130 template <
typename N1,
typename N2>
131 neighb<mln_deduce(N1, window, regular)>
134 typedef mln_deduce(N1, window, regular) W1;
135 W1 win =
diff(exact(nbh1).win(), exact(nbh2).win());
145 template <
typename W1,
typename W2>
148 operator-(const Window<W1>& win1, const Window<W2>& win2)
153 template <
typename N1,
typename N2>
154 neighb<mln_deduce(N1, window, regular)>
160 # endif // ! MLN_INCLUDE_ONLY
165 #endif // ! MLN_WIN_DIFF_HH