Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Please explain typedef statement -- Easy One

Posted on 1999-01-21
2
Medium Priority
?
262 Views
Last Modified: 2012-08-14
What type does TYPELIB_DATA end up being??
Please explain as to a newbie.
Thanks in advance.

typedef CTypedPtrArray<CPtrArray, CTypeLibraryData*> TYPELIB_DATA;
0
Comment
Question by:shark351
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1184818
TYPELIB_DATA is a type, that is what typedef does: it creates new types.

The type of TYPELIB is a CTypedPtrArray. But CTypedPtrArray is different in that it is a template class. So the stuff in between the < and > indicate how the template is specialized. In this case, CPtrArray and CTypeLibraryData*.

CPtrArray is the class that provides the implementation of how CTypedPtrArray should work. The CTypeLibraryData* is the type of data to be stored in the array.

So ultimately, TYPELIB_DATA is an array of pointers to CTypeLibraryData.
0
 
LVL 1

Expert Comment

by:Aggarwal
ID: 1184819
typedef doesn't create a new type , it creates a new name for an existing  type .

typedef creates a new name "TYPELIB_DATA" to an existing type "CTypedPtrArray<CPtrArray, CTypeLibraryData*>" , its very much clear that CTypedPtrArray is a template class .
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question