dimanche 1 septembre 2019

Programmatically differentiate between PODs and user types

I want to distinguish between my data in binary format and POD data, something along of lines:

struct my_data{ uint8_t dubs=0; };
uint8_t subs = 0;

bool is_my_data( void* data ){ 
   //if my data
   return true;
   // else 
   return false;
}


I have came across new PODs vs custom data, types using SFINAE and void_t and member name exists in a class which went heavily over my head.

I come from python background in which I could just call isinstance or search in __builtin__ dictionary to find if data is user based or came with an package of some sort. I wish to do similarly in c++ after which I can check if data is mine (all have unique static variable) to retrieve such variable.

How can we distinguish between PODs and user data programmatically? I am guessing the real reason is in this SFINAE thing and if it is can a kind soul explain it with a tad bit more patience than previous answers?

Aucun commentaire:

Enregistrer un commentaire