I'm writing a program in C++ and an external header file I'm using makes very liberal use of typedefs within class declarations.
So, when I go to lookup the return type of a function, I'll see GlobalVariableList FooBar(), but then to actually store the type it returns, I can't just use GlobalVariableType because its a typedef of iplist<GlobalVariabl> declared within the class I'm referencing in the header file.
Is it possible access a class's typedef declared within it at all from outside of the class?
You can do it if the typedef is public
class foo
{
public:
typedef std::vector<bar> barContainer;
//...
}
foo::barContainer
classname::typedefname
should work like a charm; GNU Radio does this all over the place:
basic_block
basic_block::basic_block(const std::string &name,
io_signature::sptr input_signature,
io_signature::sptr output_signature)
io_signature
typedef boost::shared_ptr<io_signature> sptr;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With