Skip to content

Instantly share code, notes, and snippets.

@merf
Created January 31, 2014 12:03
Show Gist options
  • Save merf/8730815 to your computer and use it in GitHub Desktop.
Save merf/8730815 to your computer and use it in GitHub Desktop.
Can't figure out whats wrong here...
//I often want to typedef shared_pts to classes like:
typedef std::shared_ptr<CThing> TThingPtr;
//Figured it'd be easy to wrap this in a macro like:
#define SHARED_PTR(Name) typedef std::shared_ptr<C##Name> T##NamePtr;
//but:
SHARED_PTR(Thing)
TThingPtr p; //ERROR: Unknown type TThingPtr
//and:
SHARED_PTR(Thing1)
SHARED_PTR(Thing2) //ERROR: Typedef redefinition with different types ('shared_ptr<class CThing1>' vs 'shared_ptr<class CThing2>')
//???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment