Greg wrote:[color=blue]
>
ma740988@gmail.com wrote:[color=green][color=darkred]
> > > >>
> > >
> > > Greg, you missed that he wrote #include "Vector.cpp". Why some people
> > > insist on putting template code in cpp files and then pulling all sorts
> > > of tricks to compensate for this is beyond me.
> > >
> > > john[/color]
> >
> > John, my current approach when dealing with a LOT of template code is
> > to to put the implementation in a .hh file. Include the .hh file in
> > the .h file. How does this sound?
> >
> > I'm unsure why it's necessary to make the function definitions inline
> > but I suspect I could peruse the standard to find out why.[/color]
>
> Placing the function templates in a header file does not implicitly
> "inline" them. The functions still need to be declared with the
> "inline" keyword for the compiler to treat them as inline functions.
> The reason for putting the templates in the header file is to ensure
> that the compiler will have seen the template definition should it need
> to instantiate it when compiling a source file.
>[color=green]
> > I too place all my template code in a .h to make life easy. This
> > reminds me of a conversation I had with an individual who insists on
> > using void within his function arguments for member functions that take
> > no arguments. It drives me crazy and if I'm not mistaken they (see
> > below) don't mean the same thing in a C++ world but I didn't have proof
> > so I couldn't convice him.
> >
> > bool test::some_func(void) <- the use of void here is not the same in
> > C++ correct?
> > { return 1;}[/color]
>
> I think you have specifics reversed - that is, the declaration without
> "void":
>
> int some_func();
>
> is not the same in C as it is in C++. In C++ some_func accepts no
> parameters. In C, some_func may accept an int parameter (since the
> parameter list has been omitted, an int parameter is assumed).
>
> To declare a a function that accepts no parameters in C it is therefore
> necessary to use the "void" parameter list in order to distinguish it
> from the declaration without a paramter list - and for which an int
> parameter is assumed. C++ never needs a void parameter list, since the
> parameter list is always present in a function's declaration; if the
> parameter list is empty, then the function accepts no parameters.
>
> So although the void is unnecessary and even annoying in C++, it is not
> actually changing the meaning of the declaration.
>
> Greg[/color]
Appreaciate it Greg!! You're right I had my specifics backwords. I'll
get over my annoyance - I suppose :)