3 ms·
You just have to use forward declaration headers in you headers. For your two examples : -> flat_map: https://www.boost.org/doc/libs/1_67_0/boost/container/con
by Rexxar 6y ago
You just have to use forward declaration headers in you headers. For your two examples :
-> flat_map: https://www.boost.org/doc/libs/1_67_0/boost/container/container_fwd.hpp https://www.boost.org/doc/libs/1_67_0/boost/container/contai...
-> optional: https://www.boost.org/doc/libs/1_67_0/boost/optional/optional_fwd.hpp https://www.boost.org/doc/libs/1_67_0/boost/optional/optiona...
- quietbritishjim 6y agoThat's true, but it creates an annoying extra burden on anyone that calls those functions to include the full-fat library header themselves. Since they might simply write `auto x = my_obj.returns_optional()`, it might not even be that obvious they need to add that header. Plus, of course, once they have added that header to their file, that header is included in their file, if you see what I mean, so it may not actually save compilation time while still adding coding effort. Really, I think that technique is only useful if you're only referring to those types (a) in private functions, and (b) by reference or pointer. By the time it's a public function, you have a responsibility to include the full library header in your header file.