libtins 4.5
Loading...
Searching...
No Matches
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.
 
 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

◆ repr_type

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

The type used to store the value.

Constructor & Destructor Documentation

◆ small_uint() [1/2]

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

Value initializes the value.

◆ small_uint() [2/2]

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

◆ operator repr_type()

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

User defined conversion to repr_type.

Member Data Documentation

◆ max_value

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: