CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Bit< T, j, i > Class Template Reference

Select the bits i to j from a word of type T. More...

#include <cc/bits>

Public Member Functions

 Bit (T &word)
 Create a new bit selector.
 
 Bit (const Bit &)=delete
 Delete copy constructor.
 
Bitoperator= (const Bit &)=delete
 Delete copy operator.
 
 operator T () const
 Return value of selection
 
template<class Value >
Bitoperator= (Value value)
 Assign a new value to the bit selection.
 
template<class Value >
Bitoperator|= (Value value)
 Combine a new value to the bit selection using the or operator.
 
template<class Value >
Bitoperator^= (Value value)
 Combine a new value to the bit selection using the xor operator.
 
template<class Value >
Bitoperator&= (Value value)
 Combine a new value to the bit selection using the and operator.
 

Detailed Description

template<class T, unsigned j, unsigned i = j>
class cc::Bit< T, j, i >

Select the bits i to j from a word of type T.

Template Parameters
TUnsigned integer type
jHigh bit position
iLow bit position
See also
bit

Constructor & Destructor Documentation

◆ Bit() [1/2]

template<class T , unsigned j, unsigned i = j>
Bit ( T & word)

Create a new bit selector.

Parameters
wordWord to select bits from

◆ Bit() [2/2]

template<class T , unsigned j, unsigned i = j>
Bit ( const Bit< T, j, i > & )
delete

Delete copy constructor.

Member Function Documentation

◆ operator=() [1/2]

template<class T , unsigned j, unsigned i = j>
Bit & operator= ( const Bit< T, j, i > & )
delete

Delete copy operator.

◆ operator T()

template<class T , unsigned j, unsigned i = j>
operator T ( ) const

Return value of selection

◆ operator=() [2/2]

template<class T , unsigned j, unsigned i = j>
template<class Value >
Bit & operator= ( Value value)

Assign a new value to the bit selection.

◆ operator|=()

template<class T , unsigned j, unsigned i = j>
template<class Value >
Bit & operator|= ( Value value)

Combine a new value to the bit selection using the or operator.

◆ operator^=()

template<class T , unsigned j, unsigned i = j>
template<class Value >
Bit & operator^= ( Value value)

Combine a new value to the bit selection using the xor operator.

◆ operator&=()

template<class T , unsigned j, unsigned i = j>
template<class Value >
Bit & operator&= ( Value value)

Combine a new value to the bit selection using the and operator.