Ŀ
 type_info.cpp 


#include <stdio.h>
#include <stdlib.h>
#include <functional>
#include <typeinfo>

#define WR /*WR*/
#define RC /*RC*/

#define export using
#define sealed /*sealed*/

#define with std::function
typedef void * pstruct;

#define size_of(x) ( sizeof (x) )
#define array_size(x) ( sizeof (x) )

#define t_id(x) ( typeid (x).hash_code () )
#define t_name(x) ( typeid (x).name () )

typedef unsigned char byte;
typedef unsigned long ulong;
typedef char * pchar;

/* * */

sealed namespace colors
{
  struct WR rgb
  {
    byte _,
         red, 
         green, 
         blue = 0;

    byte is_empty () 
    {
      return (!red && !green && !blue) ? 1 : 0;
    }
  }; typedef rgb * p_rgb;
}

export colors::rgb; export colors::p_rgb;

/* * */

int main ()
{
  rgb red = { .red = 255 };
  p_rgb black = new rgb {0};

  printf ("%d\t %s\n", t_id (red),    t_name (red));
  printf ("%d\t %s\n", t_id (&red),   t_name (&red));
  printf ("%d\t %s\n", t_id (*black), t_name (*black));
  printf ("%d\t %s\n", t_id (black),  t_name (black));

  printf ("%d\n", red.is_empty ());
  printf ("%d\n", black->is_empty ());

  return 0;
}