C++ (Qt)std::cout << a() << b() << c() << std::endl;
C++ (Qt)struct CBigClass {... QList<CData> mData; QSet<CData *> mSelection; ...};
void doWork(const CData &data){}template<typename С>void iterateContainer(const С& c){ for (const auto &item: c) { if constexpr (std::is_pointer_v<C::value_type>) doWork(*item); else doWork(item); }}
..}
struct CBigClass {... QList<CData*> mData; QSet<CData *> mSelection; ...}илиstruct CBigClass {... QList<CData> mData; QSet<reference_wrapper<CData>> mSelection; ...};
C++ (Qt)auto & dst = useSelection ? mSelection : mData;for (auto & data : dst) { ..}
C++ (Qt)void CBigClass::SomeMethod( bool useSelection ) { .. int limit = useSelection ? mSelection.size() : mData.size(); auto dataIt = mData.begin(); auto selIt = mSelection.begin(); for (int i = 0; i < limit; ++i) { CData * dataPtr; if (useSelection) { dataPtr = *selIt; ++selIt; } else { dataPtr = &(*dataIt); ++dataIt; } ... }}