jeudi 27 octobre 2016

Retrieve default value of in-class initialized member

Is there any way of directly retrieving the default value of a member, which has been defined using in-class initialization? For example:

struct Test
{
    int someValue = 5;
};

int main(int argc,char *argv[])
{
    auto val = declvalue(Test::someValue); // Something like this; Should return 5
    std::cout<<val<<std::endl;
    for(;;);
    return 0;
}

Basically something that 'copies' (Similar to decltype) the entire declaration, including the default value. Does something like that exist?

Aucun commentaire:

Enregistrer un commentaire