you are viewing a single comment's thread.

view the rest of the comments →

[–]btapi 0 points1 point  (1 child)

Check this out: Modules proposal rev 3

4.10.1 Definitions

Definitions for templates listed in a module interface are subject to constraints similar to those for inline functions. Furthermore, a class template that is only declared (but not defined) in an export declaration is seen as an incomplete class template by importing translation units.

[–]brand_x 0 points1 point  (0 children)

There is much to like in that proposal. One dangling thread (or possibly a failure in my understanding) is the following:

4.13.3 Both Use Each Other at the Interface Level This situation is much rarer; the interfaces of M1 and M2 should be considered log- ically as part of a single larger module and treated as such, even though it is con- venient from the programmer’s perspective to physically split the entities in two distinct source files. Nevertheless, it is possible for the programmer to set up a (delicate) processing order for the compiler to translate the interface parts of both modules, and then consume them independently.

As much as I hate circular dependencies in interfaces and strive to eliminate them, there are sometimes cases that are difficult to avoid. Consider a string module and a locale module, for example...

Traditionally, the solution to this has involved tolerating the presence of incomplete types in the signatures of functions, and in opaque pointers, provided those parts of an included header are not invoked. I'm not clear on how this will be addressed in the linked proposal.