Commit 00fd9b3e035c9c155f15a52ef7dfa3366d35662f
1 parent
bde44c18
Update C++-11 notes
Showing
1 changed file
with
13 additions
and
9 deletions
TODO
| @@ -15,15 +15,19 @@ C++-11 (for qpdf 10) | @@ -15,15 +15,19 @@ C++-11 (for qpdf 10) | ||
| 15 | 15 | ||
| 16 | * My c++11 branch adds autoconf tests to require C++-11 and | 16 | * My c++11 branch adds autoconf tests to require C++-11 and |
| 17 | re-implements PointerHolder so that it is interchangeable with | 17 | re-implements PointerHolder so that it is interchangeable with |
| 18 | - std::shared_ptr. Once this is in master, it will be possible to | ||
| 19 | - globally replace PointerHolder with std::shared_ptr. This will break | ||
| 20 | - binary compatibility, but if people want source compatibility, they | ||
| 21 | - just have to explicitly include qpdf/PointerHolder.hh. We should | ||
| 22 | - actually look at every use of PointerHolder to see which ones need | ||
| 23 | - to be std::shared_ptr and which ones can be std::unique_ptr. For | ||
| 24 | - source compatibility, all uses of PointerHolder in the API should be | ||
| 25 | - changed to std::shared_ptr, though most likely they have to be that | ||
| 26 | - anyway since std::unique_ptr is not copiable. | 18 | + std::shared_ptr. It is not actually possible to just replace |
| 19 | + PointerHolder with std::shared_ptr for two reasons: there is no | ||
| 20 | + automatic creation of std::shared_ptr<T> from T* like there is for | ||
| 21 | + PointerHolder, which breaks some code, and also there is no | ||
| 22 | + automatic conversion from something like | ||
| 23 | + std::vector<PointerHolder<T>> to std::vector<std::shared_ptr<T>>. It | ||
| 24 | + may be a good idea to replace PointerHolder with std::shared_ptr in | ||
| 25 | + the API even if it requires some work for the developer, but even if | ||
| 26 | + that isn't worth it, we should find all occurrences of PointerHolder | ||
| 27 | + within the code and replace with std::shared_ptr or std::unique_ptr | ||
| 28 | + as needed. This will definitely break binary compatibility as the | ||
| 29 | + PointerHolder<Members> pattern is part of the ABI for almost every | ||
| 30 | + class. | ||
| 27 | 31 | ||
| 28 | * QIntC.hh could be simplified with type_traits. | 32 | * QIntC.hh could be simplified with type_traits. |
| 29 | 33 |