Hi!

> I wonder how clients of the class declared in the .hpp file can use that 
> class at all.
> Unless I am missing something, they won’t be able to (at least not in the 
> general case)
> unless they also include the .inl file.

Depends from what part of the module API you want to use. E.g. if only macros or
types/classes are need, including the .hpp is faster and sufficient. This means 
a .hpp
will typically include other .hpp.

If you want to call functions you will include .inl. This means a .cpp or a 
.inl will
typically include other .inl.

> Wouldn’t it be simplier to #include the inl file in the hpp file? That way 
> you still
> have separation of declaration and definition on a file-level, but don’t 
> expose users of
> your C++ headers (including moc) to your way of organizing things.

Tried that before. Then it turned out that on the .inl level a mutual 
dependency lock can
happen (similar to what you get if normal hpp/cpp modules try to include 
include eachother
without using forward declarations). Only the two-level-inclusion as described 
above
reliably solves all mutual inclusion issues.

-- 
Best Regards,
Bernhard Lindner

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to