From: Sunburned S. <sun...@gm...> - 2007-05-27 01:49:42
|
I haven't had time for lib2geom like I wanted the last couple of weeks, but I finally had time to sit down and look at the header file for the Quadtree Class. I had a couple of C++ questions that came up while I was doing this, and I was hoping you guys would be able to help. The questions are on C++ syntax. Let me ask about a couple of statements in the portion of the header file where the Quad class is defined: [1] What are we doing in the "std::vector<int> data;" statement? I think we are declaring a data type from the standard namespace named "data" that has a data type of "vector", but I'm a little confused about the "<int>". What is that doing in their? Also, is std:vector a struct or a class, and how would I find this out on my own? [2] It looks like we define a function, perhaps a constructor, named Quad() in this portion of the header file. I'm confused because it looks like this function has statements in its body, and I thought header files only contained function prototypes. Was I mistaken about this? Are constructors an exception to this rule? [3] The statement "typedef std::vector<int>::iterator iterator;" has me totally lost. :] I know the keyword "typedef" can be used to create an alias of sorts. I think this statement is creating and alias for the std:vector data type. Are we saying that we want to be able to refer to an instance of "std:vector" as "iterator"? What is that "<int>" doing in there again? Is that something like Java Generics? Thanks for your patience with my efforts to learn C++ and the lib2geom code base. I'm sorry its been so long since you guys have heard from me. I hope all is going well. Scott Huey |