lundi 16 décembre 2019

Is only "void" in non-referenceable type?

#include <iostream>
using std::cout;
using std::endl;
using std::boolalpha;
using std::add_rvalue_reference_t;
using std::is_reference_v;


int main(void) {

    cout << boolalpha << is_reference_v<add_rvalue_reference_t<int>> << endl;    // true
    cout << boolalpha << is_reference_v<add_rvalue_reference_t<int &>> << endl;  // true
    cout << boolalpha << is_reference_v<add_rvalue_reference_t<int &&>> << endl; // true
    cout << boolalpha << is_reference_v<add_rvalue_reference_t<void>> << endl;   // false

    return 0;
}

I wonder if there are any other types besides void that are non referenceable?

Aucun commentaire:

Enregistrer un commentaire