Extension .inl

D

Dave

Is it fairly well accepted for the implementation file of a library class or
function template to have a .inl (for inline) extension? Example:

my_library.h:
template <class T>
class problem_solver
{
public:
int solve(const T &problem);
};

#include "my_library.inl"

my_library.inl:
template <class T>
int problem_solver<T>::solve(const T &problem)
{
....
}


Obviously, I could put the implementation directly in the header file. But
in the case where one wants to separate the implementation from the
interface (usually a good idea!), is .inl commonly accepted? I've seen it a
few places and somewhere along the line I picked it up myself (I don't
remember where), but I would like to find out to what extent it is common
practice.
 
J

John Carson

Dave said:
Is it fairly well accepted for the implementation file of a library
class or function template to have a .inl (for inline) extension?
Example:

my_library.h:
template <class T>
class problem_solver
{
public:
int solve(const T &problem);
};

#include "my_library.inl"

my_library.inl:
template <class T>
int problem_solver<T>::solve(const T &problem)
{
...
}


Obviously, I could put the implementation directly in the header
file. But in the case where one wants to separate the implementation
from the interface (usually a good idea!), is .inl commonly accepted?
I've seen it a few places and somewhere along the line I picked it up
myself (I don't remember where), but I would like to find out to what
extent it is common practice.


Microsoft uses it for its MFC and ATL libraries. This alone is about enough
to make it qualify as "common practice".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top