Task #12174 (closed)
Opened 10 years ago
Closed 9 years ago
C++: Revisit use of std namespace in compat headers
Reported by: | rleigh | Owned by: | rleigh |
---|---|---|---|
Priority: | minor | Milestone: | 5.x |
Component: | Bio-Formats | Version: | 5.0.1 |
Keywords: | cpp | Cc: | |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description
The compat headers exist to provide a consistent set of types which work across different compilers. The current strategy is to use the C++ type from the std:: namespace, where available, and if not available fall back to using the corresponding type from the boost:: namespace (or potentially elsewhere).
This is all working fine, however when it comes to exposing these types to users of the library, we are actually polluting the std:: namespace with the boost types. Now, this does only occur on old systems with older standard libraries, but this could be considered a bit antisocial. These types will certainly leak into the APIs and implementations of any downstream consumer (even it it's really boost under the hood).
We might want to import all std:: or boost:: types into the ome:: (or ome::compat::) namespace so that we can use a consistent name for each type internally and externally, which won't pollute std::. Thus, for example:
std::shared_ptr (which might be in reality boost::shared_ptr)
would be ome::shared_ptr (or ome::compat::shared_ptr).
Change History (2)
comment:1 Changed 10 years ago by rleigh
- Keywords cpp added
comment:2 Changed 9 years ago by rleigh
- Resolution set to fixed
- Status changed from new to closed
Fixed in https://github.com/openmicroscopy/bioformats/pull/1609