473,322 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Templates and header organization

When not using any templates I use Stroustrup's convention for
oraganizing my headers. For example, if I am implementing a module
called mymodule, then I have the following header organization:

mymodule.hpp - contains declarations and inline functions needed by
users of my_module
mymodule-impl.hpp - contains all declarations needed by the module.
This file #includes mymodule.hpp for consistency checking.
mymodule.cpp - contains the definitions. #includes mymodule-impl.hpp

I'd like to know what conventions others use when a module contains
templated functions and/or classes. My own attempts at a general
convention has failed. For example I once tried:

mymodule.hpp - declarations and inline functions for users. Must
#include mymodule-templ.hpp.
mymodule-templ.hpp - definitions of templated functions/members
needed by users
mymodule-impl.hpp - contains all declarations. #includes
mymodule.hpp for consistency.
mymodule.cpp - contains all non-template definitions. #includes
mymodule-impl.hpp

The problem is that sometimes functions in mymodule-templ.hpp need to
use functions not intended for users. Thereofore, I end up #including
mymodule-impl.hpp within mymodule-templ.hpp anyway, and so making
every declaration visible to the users code.

Cheers,
/ALiX

Sep 18 '07 #1
0 1046

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vince C. | last post by:
Hi all, I've created XML documents that are described with a schema. I'm using those documents to create web pages. All my web pages contain a fixed header and a variable document part. The...
3
by: Lord Labakudas | last post by:
Hi, I have the following simple template implementation: // -------------- b.h ----------------- // template <class t> class b { public: b() ;
23
by: Eric | last post by:
I've got a fairly simple setup that I thought would work, but I am getting link errors. template <class T> class TType { public: TType( void ) {} virtual ~TType( void ) {}
3
by: mark wade | last post by:
Thanks for your help in advance. Hello, I am just learning HTML and are using HTML-KIT. I am wondering if HTML-Kit has a bunch of templates to choose from to build a website. I see that...
11
by: Micha | last post by:
Hello there, I think I've run into some classic c++ pitfall and maybe some of you guys can help me out. For my project I will need to use matrices and vectors and so I decided to implement them...
6
by: Mitch | last post by:
I'm trying to use page inheritance so that I can derive all web pages from a template. There are a bunch of examples at this site http://authors.aspalliance.com/PaulWilson/Articles/?id=1, but...
3
by: Johs | last post by:
I have read that when you are using templates you are making generic programs. But I don't see whats so generic about templates. You can make generic programs without templates through the use of...
18
by: ciccio | last post by:
Hi all, The intel c++ compiler supports exported templates but I was wondering a bit about their used syntax. If I compare the syntax written in strostroup's book then there is a difference. ...
0
by: Rune Allnor | last post by:
Hi all. I have these classes, implemented as templates in header files. Right now I have one file per class, where both the declarations and implementations of one class are located in each...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.