|
From: <ric...@us...> - 2011-09-07 20:04:44
|
Revision: 1093
http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1093&view=rev
Author: rich_sposato
Date: 2011-09-07 20:04:38 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
Changed return type for assignment functions.
Modified Paths:
--------------
trunk/include/loki/SafeBits.h
Modified: trunk/include/loki/SafeBits.h
===================================================================
--- trunk/include/loki/SafeBits.h 2011-09-07 00:06:19 UTC (rev 1092)
+++ trunk/include/loki/SafeBits.h 2011-09-07 20:04:38 UTC (rev 1093)
@@ -250,12 +250,12 @@
// These operators are private, and will not instantiate in any
// event because of the incomplete Forbidden_conversion struct.
- template < typename T > SafeBitConst operator|( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitConst operator&( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitConst operator^( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitConst operator|=( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitConst operator&=( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitConst operator^=( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitConst & operator|( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitConst & operator&( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitConst & operator^( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitConst & operator|=( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitConst & operator&=( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitConst & operator^=( T ) const { Forbidden_conversion< T > wrong; return *this; }
// And the same thing for comparisons: private and unusable.
// if ( label1 == label2 ) { ... }
@@ -333,17 +333,17 @@
SafeBitField operator & ( const SafeBitField & rhs ) const { return SafeBitField( word & rhs.word ); }
SafeBitField operator ^ ( const SafeBitField & rhs ) const { return SafeBitField( word ^ rhs.word ); }
SafeBitField operator ~ ( void ) const { return SafeBitField( ~word ); }
- SafeBitField operator |= ( const SafeBitField & rhs ) { word |= rhs.word; return *this; }
- SafeBitField operator &= ( const SafeBitField & rhs ) { word &= rhs.word; return *this; }
- SafeBitField operator ^= ( const SafeBitField & rhs ) { word ^= rhs.word; return *this; }
+ SafeBitField & operator |= ( const SafeBitField & rhs ) { word |= rhs.word; return *this; }
+ SafeBitField & operator &= ( const SafeBitField & rhs ) { word &= rhs.word; return *this; }
+ SafeBitField & operator ^= ( const SafeBitField & rhs ) { word ^= rhs.word; return *this; }
/// Bitwise operators that use bit-constants.
SafeBitField operator | ( const_t rhs ) const { return SafeBitField( word | rhs.word ); }
SafeBitField operator & ( const_t rhs ) const { return SafeBitField( word & rhs.word ); }
SafeBitField operator ^ ( const_t rhs ) const { return SafeBitField( word ^ rhs.word ); }
- SafeBitField operator |= ( const_t rhs ) { word |= rhs.word; return *this; }
- SafeBitField operator &= ( const_t rhs ) { word &= rhs.word; return *this; }
- SafeBitField operator ^= ( const_t rhs ) { word ^= rhs.word; return *this; }
+ SafeBitField & operator |= ( const_t rhs ) { word |= rhs.word; return *this; }
+ SafeBitField & operator &= ( const_t rhs ) { word &= rhs.word; return *this; }
+ SafeBitField & operator ^= ( const_t rhs ) { word ^= rhs.word; return *this; }
// Conversion to bool.
// This is a major source of headaches, but it's required to support code like this:
@@ -361,15 +361,15 @@
// It is somewhat safer to convert to a pointer, at least pointers to different types cannot be readilly compared, and there are no
// bitwise operations on pointers, but the conversion from word_t to a pointer can have run-time cost if they are of different size.
//
- operator const bool() const { return ( 0 != word ); }
+ operator bool() const { return ( 0 != word ); }
// Shift operators shift bits inside the bit field. Does not make
// sense, most of the time, except perhaps to loop over labels and
// increment them.
SafeBitField operator << ( unsigned int s ) { return SafeBitField( word << s ); }
SafeBitField operator >> ( unsigned int s ) { return SafeBitField( word >> s ); }
- SafeBitField operator <<= ( unsigned int s ) { word <<= s; return *this; }
- SafeBitField operator >>= ( unsigned int s ) { word >>= s; return *this; }
+ SafeBitField & operator <<= ( unsigned int s ) { word <<= s; return *this; }
+ SafeBitField & operator >>= ( unsigned int s ) { word >>= s; return *this; }
// Word size is also the maximum number of different bit fields for
// a given word type.
@@ -394,12 +394,12 @@
// These operators are private, and will not instantiate in any
// event because of the incomplete Forbidden_conversion struct.
- template < typename T > SafeBitField operator | ( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitField operator & ( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitField operator ^ ( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitField operator |= ( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitField operator &= ( T ) const { Forbidden_conversion< T > wrong; return *this; }
- template < typename T > SafeBitField operator ^= ( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitField & operator | ( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitField & operator & ( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitField & operator ^ ( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitField & operator |= ( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitField & operator &= ( T ) const { Forbidden_conversion< T > wrong; return *this; }
+ template < typename T > SafeBitField & operator ^= ( T ) const { Forbidden_conversion< T > wrong; return *this; }
// And the same thing for comparisons:
// if ( label1 == label2 ) { ... }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|