CXXR (C++ R) API
Classes | Functions
CXXR::ElementTraits Namespace Reference

Namespace encapsulating traits of R vector element types. More...

Classes

struct  Data
 Information about the data payload. More...
struct  DetachReferents
 Function object for detaching referents. More...
struct  HasReferents
 Do elements of this type refer to GCNode objects? More...
struct  MustConstruct
 Do elements of this type require construction? More...
struct  MustDestruct
 Does this type have a destructor? More...
struct  Serialize
 Function object for serialization/deserialization. More...
struct  VisitReferents
 Function object for visiting referents. More...
struct  NAFunc
 Function object to generate 'not available' value. More...
struct  IsNA
 Function object for testing 'not available' status. More...

Functions

template<typename T >
const ElementTraits::Data< T >
::type & 
data (const T &t)
 Access the data payload of an R vector element.
template<typename T >
bool hasDistinctNA ()
 Does a type have a distinct 'not available' value?

Detailed Description

Namespace encapsulating traits of R vector element types.

This namespace is used to record characteristics of types capable of being used as the elements of R data vectors, to facilitate the writing of generic algorithms manipulating such vectors.


Function Documentation

template<typename T >
const ElementTraits::Data<T>::type& CXXR::ElementTraits::data ( const T &  t)
inline

Access the data payload of an R vector element.

This templated function is syntactic sugar for the Data::get() function. It should not be specialized: instead specialize ElementTraits::Data itself.

Template Parameters:
Ttype used as an element in the CXXR implementation of an R vector type.
Parameters:
tReference to an object of type T .
Returns:
reference to the data payload contained within t .
template<typename T >
bool CXXR::ElementTraits::hasDistinctNA ( )
inline

Does a type have a distinct 'not available' value?

Returns:
true iff the range of type T includes a distinct value to signify that the actual value of the quantity is not available.