Skip to content

Commit 9ea96eb

Browse files
authored
fixed const on ILogStream, added some platform macros and fixed compiler warnings on concepts
1 parent b62c822 commit 9ea96eb

3 files changed

Lines changed: 25 additions & 15 deletions

File tree

src/PyroCommon/Concepts.hpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
namespace PyroshockStudios {
2727
template <typename From, typename To>
2828
concept ConvertibleTo =
29-
requires {
30-
static_cast<To>(eastl::declval<From>());
29+
requires(From f) {
30+
static_cast<To>(f);
3131
};
3232

3333
template <typename T>
@@ -48,9 +48,7 @@ namespace PyroshockStudios {
4848

4949
template <typename T>
5050
concept CopyMoveableConcept =
51-
requires {
52-
CopyableConcept<T>&& MoveableConcept<T>;
53-
};
51+
CopyableConcept<T> && MoveableConcept<T>;
5452

5553
template <typename T>
5654
concept IterableConcept =
@@ -61,16 +59,19 @@ namespace PyroshockStudios {
6159

6260
template <typename T>
6361
concept CollectionConcept =
62+
IterableConcept<T> &&
6463
requires(const T& t) {
65-
requires IterableConcept<T>;
6664
t.size();
6765
};
6866

6967
template <typename C>
70-
concept ContiguousCollectionConcept = requires(C& c) {
71-
{ c.data() } -> ConvertibleTo<typename eastl::add_pointer_t<eastl::remove_reference_t<decltype(*c.data())>>>;
72-
{ c.size() } -> ConvertibleTo<size_t>;
73-
};
68+
concept ContiguousCollectionConcept =
69+
requires(C& c) {
70+
{ c.data() } -> ConvertibleTo<typename eastl::add_pointer_t<
71+
eastl::remove_reference_t<decltype(*c.data())>>>;
72+
{ c.size() } -> ConvertibleTo<size_t>;
73+
};
74+
7475
template <typename T>
7576
concept MapConcept =
7677
requires(const T& t) {
@@ -97,9 +98,9 @@ namespace PyroshockStudios {
9798
c.push_back(v);
9899
};
99100

100-
template <typename C>
101-
concept EmplaceBackableConcept = requires(C& c, eastl::remove_cvref_t<decltype(*c.begin())> v) {
102-
c.push_back(v);
101+
template <typename C, typename... Args>
102+
concept EmplaceBackableConcept = requires(C& c, Args&&... args) {
103+
c.emplace_back(eastl::forward<Args>(args)...);
103104
};
104105

105106
template <typename T>

src/PyroCommon/LoggerInterface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace PyroshockStudios {
3838
ILogStream() = default;
3939
~ILogStream() = default;
4040

41-
virtual void Log(LogSeverity severity, const char* message) const = 0;
41+
virtual void Log(LogSeverity severity, const char* message) = 0;
4242
virtual LogSeverity MinSeverity() const = 0;
4343
virtual const char* Name() const = 0;
4444
};
@@ -47,6 +47,6 @@ namespace PyroshockStudios {
4747
ILoggerAware() = default;
4848
~ILoggerAware() = default;
4949

50-
virtual void InjectLogger(const ILogStream* stream) = 0;
50+
virtual void InjectLogger(ILogStream* stream) = 0;
5151
};
5252
} // namespace PyroshockStudios

src/PyroCommon/Platform.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,17 @@
5858
#endif
5959

6060
#if defined(__APPLE__)
61+
#include <TargetConditionals.h>
62+
6163
#define PYRO_PLATFORM_FAMILY_UNIX 1
64+
#define PYRO_PLATFORM_FAMILY_APPLE 1
65+
66+
#if defined(TARGET_OS_OSX)
6267
#define PYRO_PLATFORM_MACOS 1
68+
#elif defined(TARGET_OS_IOS)
69+
#define PYRO_PLATFORM_IOS 1
70+
#endif
71+
6372
#endif
6473

6574

0 commit comments

Comments
 (0)