Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11799 - /trunk/libzypp/zypp/TriBool.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Tue, 25 Nov 2008 13:00:48 -0000
  • Message-id: <20081125130048.AA1C0FB8D3@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Tue Nov 25 14:00:48 2008
New Revision: 11799

URL: http://svn.opensuse.org/viewcvs/zypp?rev=11799&view=rev
Log:
fix comparison of tribool::indeterminate

Modified:
trunk/libzypp/zypp/TriBool.h

Modified: trunk/libzypp/zypp/TriBool.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/TriBool.h?rev=11799&r1=11798&r2=11799&view=diff
==============================================================================
--- trunk/libzypp/zypp/TriBool.h (original)
+++ trunk/libzypp/zypp/TriBool.h Tue Nov 25 14:00:48 2008
@@ -28,6 +28,11 @@
* using boost::logic::indeterminate;
* }
* \endcode
+ *
+ * \warning Be carefull.esp. when comparing \ref TriBool using
+ * \c operator==, as <b><tt>( indeterminate == indeterminate )</tt><b>
+ * does \b not evaluate \b true. It's \c indeterminate.
+ *
* \see http://www.boost.org/doc/html/tribool.html
* \ingroup BOOST
*/
@@ -35,19 +40,24 @@
using boost::logic::tribool;
using boost::logic::indeterminate;

- /** \relates TriBool stream output */
- inline std::ostream & operator<<(std::ostream & s, const TriBool & obj)
- {
- if (obj == indeterminate)
- s << "indeterminate";
- else if (obj)
- s << "true";
- else
- s << "false";
- return s;
- }
-
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
+namespace boost
+{
+ namespace logic
+ {
+ /** \relates TriBool stream output */
+ inline std::ostream & operator<<(std::ostream & s, const tribool & obj)
+ {
+ if (indeterminate(obj))
+ s << "indeterminate";
+ else if (obj)
+ s << "true";
+ else
+ s << "false";
+ return s;
+ }
+ }
+}
#endif // ZYPP_TRIBOOL_H

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages