|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60698 - sandbox/bitfield/boost/integer
From: vicente.botet_at_[hidden]
Date: 2010-03-18 15:02:27
Author: viboes
Date: 2010-03-18 15:02:25 EDT (Thu, 18 Mar 2010)
New Revision: 60698
URL: http://svn.boost.org/trac/boost/changeset/60698
Log:
Boost.Bitfield:
* Updating macros
Text files modified:
sandbox/bitfield/boost/integer/bitfield.hpp | 16 ++++++++++++++++
sandbox/bitfield/boost/integer/bitfield_dcl.hpp | 4 ++--
2 files changed, 18 insertions(+), 2 deletions(-)
Modified: sandbox/bitfield/boost/integer/bitfield.hpp
==============================================================================
--- sandbox/bitfield/boost/integer/bitfield.hpp (original)
+++ sandbox/bitfield/boost/integer/bitfield.hpp 2010-03-18 15:02:25 EDT (Thu, 18 Mar 2010)
@@ -326,6 +326,22 @@
typedef bitfield<const STORAGE_TYPE, F, L, VALUE_TYPE> value;
};
+ template <typename OSTREAM, typename ST, std::size_t F, std::size_t L
+ , typename VT
+ , typename RT>
+ OSTREAM& operator<<(OSTREAM& os, bitfield<ST, F, L, VT, RT> const& r) {
+ os << r.value();
+ return os;
+ }
+ template <typename ISTREAM, typename ST, std::size_t F, std::size_t L
+ , typename VT
+ , typename RT>
+ ISTREAM& operator>>(ISTREAM& is, bitfield<ST, F, L, VT, RT> & r) {
+ VT v;
+ is>> v;
+ r.set(v);
+ return is;
+ }
}}
#endif
Modified: sandbox/bitfield/boost/integer/bitfield_dcl.hpp
==============================================================================
--- sandbox/bitfield/boost/integer/bitfield_dcl.hpp (original)
+++ sandbox/bitfield/boost/integer/bitfield_dcl.hpp 2010-03-18 15:02:25 EDT (Thu, 18 Mar 2010)
@@ -17,8 +17,8 @@
#define BOOST_BITFIELD_DCL(STORAGE_TYPE, STORAGE_VAR, VALUE_TYPE, FIELD, F, L) \
typedef boost::integer::bitfield_traits<STORAGE_TYPE,F,L,VALUE_TYPE> FIELD##_type; \
FIELD##_type::reference FIELD() { return FIELD##_type::reference(STORAGE_VAR); } \
- FIELD##_type::value::value_type FIELD() const { return FIELD##_type::value(word).get(); } \
+ FIELD##_type::value::value_type FIELD() const { return FIELD##_type::value(STORAGE_VAR).get(); } \
void set_##FIELD(VALUE_TYPE& val) { FIELD##_type::reference(STORAGE_VAR).set(val); } \
- FIELD##_type::value::value_type get_##FIELD() const { return FIELD##_type::value(word).get(); }
+ FIELD##_type::value::value_type get_##FIELD() const { return FIELD##_type::value(STORAGE_VAR).get(); }
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk