Changeset View
Changeset View
Standalone View
Standalone View
agents/unifiedmailboxagent/utils.h
Show All 18 Lines | |||||
19 | 19 | | |||
20 | #ifndef UTILS_H_ | 20 | #ifndef UTILS_H_ | ||
21 | #define UTILS_H_ | 21 | #define UTILS_H_ | ||
22 | 22 | | |||
23 | #include <functional> | 23 | #include <functional> | ||
24 | #include <QHash> | 24 | #include <QHash> | ||
25 | #include <QString> | 25 | #include <QString> | ||
26 | 26 | | |||
27 | #if __has_include(<optional>) | ||||
28 | #include <optional> | ||||
29 | namespace stdx { | ||||
30 | using namespace ::std; | ||||
31 | } | ||||
32 | #else | ||||
27 | #include <experimental/optional> | 33 | #include <experimental/optional> | ||
28 | namespace stdx { | 34 | namespace stdx { | ||
29 | // Injects content of std::experimental namespace into "exp" namespace. | 35 | // Injects content of std::experimental namespace into "exp" namespace. | ||
30 | // C++ is magical. | 36 | // C++ is magical. | ||
31 | using namespace std::experimental; | 37 | using namespace ::std; | ||
38 | using namespace ::std::experimental; | ||||
32 | } | 39 | } | ||
40 | #endif | ||||
33 | 41 | | |||
34 | template<typename T> | 42 | template<typename T> | ||
35 | inline QList<T> setToList(QSet<T> &&set) | 43 | inline QList<T> setToList(QSet<T> &&set) | ||
36 | { | 44 | { | ||
37 | QList<T> rv; | 45 | QList<T> rv; | ||
38 | rv.reserve(set.size()); | 46 | rv.reserve(set.size()); | ||
39 | std::copy(set.cbegin(), set.cend(), std::back_inserter(rv)); | 47 | std::copy(set.cbegin(), set.cend(), std::back_inserter(rv)); | ||
40 | return rv; | 48 | return rv; | ||
Show All 33 Lines |