Skip to content

Provide a cpp11::na<>::value struct for the NA types? #179

Closed
@jimhester

Description

@jimhester

This can sometimes be useful if you are writing templates against the value code, e.g. something like this.

namespace cpp11 {
template <typename T> struct na {};

template <> struct na<double> { const static double value; };
const double na<double>::value = NA_REAL;

template <> struct na<int> { const static int value; };
// NA_INTEGER

template <> struct na<r_bool> { const static r_bool value; };
// NA_LOGICAL

template <> struct na<r_string> { const static r_string value; };
// NA_STRING
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions