0

Simple question; right now I have something like this:

typedef void(*MyFunctionPointer)(int);
typedef std::vector < MyFunctionPointer > MyFunctionPointerContainer;

However, I want to typedef this container in one row, skipping the first typedef, how can I do this?

3
  • 2
    Question - what for? Is this for an obfuscation contest? Commented Aug 24, 2010 at 15:10
  • Do you want to save one code line? Two typedefs look much better. Commented Aug 24, 2010 at 15:11
  • EboMike: I simply wanted to know. Commented Aug 24, 2010 at 15:37

1 Answer 1

10
typedef std::vector < void(*)(int) > MyFunctionPointerContainer;
Sign up to request clarification or add additional context in comments.

4 Comments

Damn you! Beat me by 4 seconds; +1 and nuking my duplicate.
+1, but I would still go with the typedef because I'd much rather write for( MyFunctionPointerContainer::iterator it = ... ) than for( std::vector < void(*)(int) >::iterator it = ...)
typedef MyFunctionPointerContainer::iterator MyFunctionPointerIterator; would also work...
With the new C++0x auto keyword, this will be a moot point and was defined for these types of convoluted type typing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.