title: Macro to define a type
body: <p>Is there a way in C++ to define a type based on a preprocessor flag? I have two versions of a library, one that is native and one that is built on the top of <a href="https://thrift.apache.org/" rel="nofollow">thirft</a>.</p>
  
  <p>Both versions have exactly the same function signatures, except the return and argument types. The native versions passes pointers of objects around, while the thirft version uses i64 to represent the pointers.</p>
  
  <p>I was wondering if there is a way for be to build a project that would use any of the libraries based on a compilation flag. So for example:</p>
  
  <pre><code>//native
  AType* obj = fun(AnotherType* another_obj)
  
  //thirft
  i64 obj = fun(i64 another_obj)
  </code></pre>
  
  <p>I was wondering if there is a construct sort of like this:</p>
  
  <pre><code>if native
      X is Atype*
      Y is AnotherType*
  else
      X is i64
      Y is i64
  end
  
  //native
  X obj = fun(Y another_obj)
  
  //thirft
  X obj = fun(Y another_obj)
  </code></pre>