libtins  4.0
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
Tins::small_uint< n > Class Template Reference

Represents a field of n bits. More...

#include <small_uint.h>

Public Types

typedef best_type< n >::type repr_type
 

Public Member Functions

 small_uint ()
 
 small_uint (repr_type val)
 Copy constructs the stored value. More...
 
 operator repr_type () const
 

Static Public Attributes

static const repr_type max_value = power<2, n>::value - 1
 

Detailed Description

template<size_t n>
class Tins::small_uint< n >

Represents a field of n bits.

This finds the best integral type of at least n bits and uses it to store the wrapped value.

Member Typedef Documentation

template<size_t n>
typedef best_type<n>::type Tins::small_uint< n >::repr_type

The type used to store the value.

Constructor & Destructor Documentation

template<size_t n>
Tins::small_uint< n >::small_uint ( )
inline

Value initializes the value.

template<size_t n>
Tins::small_uint< n >::small_uint ( repr_type  val)
inline

Copy constructs the stored value.

This throws a value_too_large exception if the value provided is larger than max_value.

Parameters
valThe parameter from which to copy construct.

Member Function Documentation

template<size_t n>
Tins::small_uint< n >::operator repr_type ( ) const
inline

User defined conversion to repr_type.

Member Data Documentation

template<size_t n>
const repr_type Tins::small_uint< n >::max_value = power<2, n>::value - 1
static

The maximum value this class can hold.


The documentation for this class was generated from the following file: