So I'm writing this toolkit to provide functionality for a double linked list inside of a template. The toolkit functions are mostly straightforward (at least so far). I have this really simple question, though. When I am programming from main() and want to start a new list, how do I create the very first item in a list?
Thanks, that worked. In the book that I am studying, it says that when a template function is used, the compiler examines the types of arguments and automatically determines the type for Item.
Is there a better way than how I am creating this initial node? The method that I am using apparently means that I have to tell the compiler what the variable type is, which might be a hint that this isn't best method???
Just kicking the tires to figure this whole template thing out.
In your case, you have no template functions, you have a template class. The compiler's auto type deduction does not apply in this case.
Is there a better way? Dunno. Depends on what you define as "better". For example, std::string is actually a typedef of the std::basic_string class instantiated on a char. You could do something like: