00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 #ifndef MLN_UTIL_YES_HH
00027 # define MLN_UTIL_YES_HH
00028 
00032 
00033 
00034 # include <mln/core/concept/object.hh>
00035 # include <mln/core/routine/ops.hh>
00036 
00037 
00038 namespace mln
00039 {
00040 
00041   
00042   namespace util { struct yes; }
00043 
00044 
00045   namespace trait
00046   {
00047 
00048     template <>
00049     struct set_precise_unary_< op::not_, util::yes >
00050     {
00051       typedef util::yes ret;
00052     };
00053 
00054     template <template<class, class> class Op>
00055     struct set_precise_binary_< Op, util::yes, bool >
00056     {
00057       typedef util::yes ret;
00058     };
00059 
00060     template <template<class, class> class Op>
00061     struct set_precise_binary_< Op, util::yes, util::yes >
00062     {
00063       typedef util::yes ret;
00064     };
00065 
00066   } 
00067 
00068 
00069   namespace util
00070   {
00071 
00075     
00076     struct yes : public Object< yes >
00077     {
00078       yes();
00079       explicit yes(bool);
00080       operator bool() const;
00081     };
00082 
00083   } 
00084 
00085 
00086   
00087   util::yes operator ! (const util::yes& y);
00088 
00089   
00090   util::yes operator == (const util::yes&, bool);
00091   util::yes operator == (const util::yes&, const util::yes&);
00092 
00093   
00094   util::yes operator != (const util::yes&, bool);
00095   util::yes operator != (const util::yes&, const util::yes&);
00096 
00097   
00098   util::yes operator && (const util::yes&, bool);
00099 
00100   
00101   util::yes operator || (const util::yes&, bool);
00102 
00103 
00104   
00105 
00106 
00107 # ifndef MLN_INCLUDE_ONLY
00108 
00109   namespace util
00110   {
00111 
00112     
00113 
00114     inline
00115     yes::yes()
00116     {
00117     }
00118 
00119     inline
00120     yes::yes(bool)
00121     {
00122     }
00123 
00124     inline
00125     yes::operator bool() const
00126     {
00127       return true;
00128     }
00129 
00130   } 
00131 
00132   inline
00133   util::yes
00134   operator ! (const util::yes& y)
00135   {
00136     return y;
00137   }
00138 
00139   inline
00140   util::yes operator == (const util::yes&, bool)
00141   {
00142     return util::yes(true);
00143   }
00144 
00145   inline
00146   util::yes operator == (const util::yes&, const util::yes&)
00147   {
00148     return util::yes(true);
00149   }
00150 
00151   inline
00152   util::yes operator != (const util::yes&, bool)
00153   {
00154     return util::yes(true);
00155   }
00156 
00157   inline
00158   util::yes operator != (const util::yes&, const util::yes&)
00159   {
00160     return util::yes(true);
00161   }
00162 
00163   inline
00164   util::yes operator && (const util::yes&, bool)
00165   {
00166     return util::yes(true);
00167   }
00168 
00169   inline
00170   util::yes operator || (const util::yes&, bool)
00171   {
00172     return util::yes(true);
00173   }
00174 
00175 # endif // ! MLN_INCLUDE_ONLY
00176 
00177 } 
00178 
00179 
00180 #endif // ! MLN_UTIL_YES_HH