diff options
author | Sven Gothel <[email protected]> | 2021-06-10 14:41:35 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-06-10 14:41:35 +0200 |
commit | 08a26544a981bbf16375b84b62509285d35d488e (patch) | |
tree | 71149957500e6597039a723acc954bde89dc55c8 /test/test_lfringbuffer11.cpp | |
parent | 50534c737b6fa540f958b2ad638890e257479722 (diff) |
ringbuffer: Move the 'T nullelem' to ctor, simplifying ringbuffer declaration
Having the `nullelem` passed as reference as a template parameter
gives user the burden to have a static instance setup before declaration.
This is not nice.
For now, we better pass `nullelem` via the constructor.
We would like to pass `T nullelem` as a non-type template parameter of type `T`, a potential Class.
However, this is only allowed in C++20 and we use C++17 for now.
Diffstat (limited to 'test/test_lfringbuffer11.cpp')
-rw-r--r-- | test/test_lfringbuffer11.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/test_lfringbuffer11.cpp b/test/test_lfringbuffer11.cpp index eddb86d..03317a1 100644 --- a/test/test_lfringbuffer11.cpp +++ b/test/test_lfringbuffer11.cpp @@ -40,7 +40,7 @@ using namespace jau; typedef uint8_t IntegralType; typedef uint8_t TrivialType; static const TrivialType TrivialTypeNullElem(0xff); -typedef ringbuffer<TrivialType, TrivialTypeNullElem, jau::nsize_t> TrivialTypeRingbuffer; +typedef ringbuffer<TrivialType, jau::nsize_t> TrivialTypeRingbuffer; constexpr static const IntegralType integral_modulus = 254; @@ -49,12 +49,12 @@ class TestRingbuffer11 { private: TrivialTypeRingbuffer createEmpty(jau::nsize_t initialCapacity) { - TrivialTypeRingbuffer rb(initialCapacity); + TrivialTypeRingbuffer rb(TrivialTypeNullElem, initialCapacity); REQUIRE_MSG("empty "+rb.toString(), rb.isEmpty()); return rb; } TrivialTypeRingbuffer createFull(const std::vector<TrivialType> & source) { - TrivialTypeRingbuffer rb(source); + TrivialTypeRingbuffer rb(TrivialTypeNullElem, source); REQUIRE_MSG("full "+rb.toString(), rb.isFull()); return rb; } |