Extension .inl

Discussion in 'C++' started by Dave, May 23, 2004.

  1. Dave

    Dave Guest

    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.
    Dave, May 23, 2004
    #1
    1. Advertising

  2. Dave

    John Carson Guest

    "Dave" <> wrote in message
    news:
    > 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".


    --
    John Carson
    1. To reply to email address, remove donald
    2. Don't reply to email address (post here instead)
    John Carson, May 23, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anand
    Replies:
    3
    Views:
    874
    Tim Daneliuk
    Nov 8, 2003
  2. Christian Seberino
    Replies:
    3
    Views:
    1,161
    Christian Seberino
    Feb 5, 2004
  3. Steve
    Replies:
    3
    Views:
    26,940
    Steve
    Aug 25, 2006
  4. Elhanan
    Replies:
    0
    Views:
    540
    Elhanan
    Jan 23, 2007
  5. Christel Chamaret

    pbl when changing files from .inl to .cpp

    Christel Chamaret, May 2, 2006, in forum: C++
    Replies:
    1
    Views:
    308
    Victor Bazarov
    May 2, 2006
Loading...

Share This Page