Conversation
aleks-f
reviewed
Dec 11, 2025
Member
aleks-f
left a comment
There was a problem hiding this comment.
thank you for the tuple, replacement of that atrocity was long overdue and now finally it happens
…OCO_TEST_DEPRECATED is enabled. Update comments for deprecated functionality.
2ac5a08 to
f0b3958
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C++17 Modernization Summary
This document summarizes the C++17 modernization changes made to the POCO Foundation module.
Overview
The Foundation module has been modernized to take advantage of C++17 features while maintaining full backward compatibility with existing code.
Changes
1. MetaProgramming.h
Location:
include/Poco/MetaProgramming.hReplaced custom type traits with standard library equivalents:
IsReference<T>with partial specializationsstd::is_reference_v<T>IsConst<T>with partial specializationsstd::is_const_v<std::remove_reference_t<T>>TypeWrapper<T>manual type manipulationstd::remove_cv_t<std::remove_reference_t<T>>2. NumericString.h
Location:
include/Poco/NumericString.hIsNegativeImplclass hierarchy (25+ lines) with singleif constexprfunctionintToStroverloads usingif constexprstd::is_signed_v<T>instead ofstd::numeric_limits<T>::is_signed3. Delegate Classes
Location:
include/Poco/FunctionDelegate.h,include/Poco/FunctionPriorityDelegate.h,include/Poco/PriorityDelegate.hif constexprruntime branchingstd::conditional_tfor type selection4. TypeList.h (Major Rewrite - Breaking Change)
Location:
include/Poco/TypeList.hImportant: TypeList.h is now an internal header. Do not include it directly; include
Poco/Tuple.hinstead.Complete rewrite from Loki-style recursive type lists to modern variadic templates:
TypeList<Head, Tail>runtime data structure withhead/tailmembersTypeList<Ts...>compile-time only type listTypeList::HeadType,TypeList::TailTypenested typesGetter<N>::get(typeList)runtime value accessstd::get<N>()on Tuple)lengthenumsizeof...(Ts)constexprTypeGetter<N, List>recursive traversalstd::tuple_element_t<N, std::tuple<Ts...>>Breaking API changes:
TypeList<Head, Tail>no longer stores runtime values - it's now purely a compile-time type listTypeList::headandTypeList::tailmembers removedTypeList::HeadTypeandTypeList::TailTypenested types removedGetter<N>::get()removed - useTuple::get<N>()insteadTypeWrapperdependency removedKey C++17 features used:
std::tuple_element_t<N, std::tuple<Ts...>>for O(1) type access at indexstd::is_same_v<T, U>for type comparisonstd::conditional_t<B, T, F>for compile-time type selectionsizeof...(Ts)for parameter pack sizetypename... Ts)Implementation details:
TypeList<Ts...>is now a pure compile-time type holder (no data members)NullTypeListremains as a sentinel type for unused template parametersFilterNullTypeListremovesNullTypeListentries from parameter packs (internal)TypeGetterdelegates tostd::tuple_element_tfor efficient type lookupMinimal API (only what's used by Tuple/NamedTuple):
TypeListType<T0, T1, ...>::HeadType- creates a TypeList from parametersTypeGetter<N, List>::HeadType- get type at index NTypeGetter<N, List>::ConstHeadType- const versionRemoved metaprogramming utilities:
The following utilities were removed as they are not needed by Tuple/NamedTuple:
TypeLocator<List, T>::value- find index of type TTypeAppender<List, T>::HeadType- append type to listTypeOneEraser<List, T>::HeadType- erase first occurrenceTypeAllEraser<List, T>::HeadType- erase all occurrencesTypeDuplicateEraser<List>::HeadType- remove duplicatesTypeOneReplacer<List, T, R>::HeadType- replace first occurrenceTypeAllReplacer<List, T, R>::HeadType- replace all occurrences5. Tuple.h (Major Rewrite)
Location:
include/Poco/Tuple.hstd::tupleKey improvements:
std::tupleas internal storageget<N>(),set<N>(), comparison operators6. NamedTuple.h
Location:
include/Poco/NamedTuple.hNo changes required - inherits from Tuple and works automatically with the new implementation.
Code Reduction Summary
C++17 Features Used
if constexpr- Compile-time conditional code pathsstd::is_same_v<T, U>- Type comparisonstd::is_signed_v<T>- Signed type checkstd::is_reference_v<T>- Reference type checkstd::is_const_v<T>- Const type checkstd::remove_cv_t<T>- Remove const/volatilestd::remove_reference_t<T>- Remove referencestd::conditional_t<B, T, F>- Compile-time type selectionstd::tuple_element_t<N, Tuple>- Get type at indexsizeof...(Ts)- Parameter pack size(expr || ...)Backward Compatibility
All changes maintain full backward compatibility:
Poco::Tuple,Poco::NamedTuple,Poco::TypeListcontinues to worktuple.get<0>(),tuple.set<1>(val), etc.Tuple<int, std::string, double>NullTypeListstill available for compatibilityBreaking Change: Direct inclusion of
Poco/TypeList.his no longer allowed. The header now requiresPOCO_TYPELIST_INTERNALto be defined, which is automatically set when includingPoco/Tuple.h. Any code that directly includedTypeList.hshould be changed to includeTuple.hinstead.Test Results
All existing tests pass:
Performance
Compile Time
The new implementation significantly improves compile times:
sizeof...(Ts)std::tupleuseExpected improvement: 20-50% faster compilation for code heavily using Tuple/NamedTuple.
Execution Time
Runtime performance is equal or better:
std::tupleaccess:std::get<N>()is highly optimized by compiler vendors with zero overheadif constexpr: Generates identical machine code to template specializations (branches eliminated at compile time)std::tuple_element_tis compiler-intrinsic optimized vs. recursive template traversalMemory Usage
Memory efficiency is improved:
Tuple<short>Tuple<int>Tuple<int, int>Why: The old implementation had recursive
TypeList<Head, Tail>structure overhead. The new implementation usesstd::tuplewhich has optimal packing with no structural overhead.Summary
std::tupleis highly optimized by compiler vendorsif constexprgenerates identical machine code to template specializations