
On Aug 20, 2008, at 3:47 PM, Daniel James wrote:
On 20/08/2008, Simonson, Lucanus J <lucanus.j.simonson@intel.com> wrote:
[The rationale for defining the members of class templates within the class definition is that older compilers wouldn't accept separated definitions.]
Is this rational still valid for new libraries? I would imagine that there are a number of recent libraries accepted that don't support the older compilers for other reasons. I was proposing we make it a preferred practice for ongoing and future development. I would not suggest we revise mature libraries to conform to this style. Do you think that is reasonable?
It's reasonable but I'm currently working on a new library that will support older compilers so I won't be following it. I think this kind of thing is up to the developer. But feel free to suggest a patch for the guidelines. They live at:
http://svn.boost.org/svn/boost/website/public_html/beta/development/ header.html
I'll apply it if it seems decent and no one objects.
Is this just about separating the member definitions from their home class template, or is it also about which header those member definitions should go into? [An suggestion was moving the m.d. to a new header.] I think that the m.d. should stay in the same header file as class-template definition (but afterwards), so we don't have a lot of files lying around. Exceptions would be if the number of member functions (templates) was huge, or if a small fraction of the m.d. require a lot of outside headers that the other m.d. don't need. I want to go the other way briefly. This thread also talked about forwarding headers. I think those should be grouped together, by family like <iosfwd> does, to reduce proliferation and the fact that classes in a family need each others' declarations anyway. I think the headers should be like <iosfwd>, and generally only have declarations for classes, class templates, and typedefs of such, and not include functions and function templates. Leave the function- related forward declarations to the core header of the related types. (I think that C++0x adds forward declarations for enums, those can go in our headers too.) A difficulty for now is sometimes we want to use a template parameter default that doesn't have a forwarding header, which means that either the default is skipped or a heavier header is #included. The prime example is anything from the standard library that isn't needed in <iosfwd>, especially the containers. For Boost, we could retroactively add forwarding headers. -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com