From 0eb9f2caeb8356a342720ed38b3a11232f866366 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 24 Aug 2019 21:48:20 -0400 Subject: [PATCH] MIDIEncoder: Make _sendMessage overload for the ContiguousContainer concept We can utilize the std::data and std::size utility functions to support passthrough-ing data for any container that satisfies the ContiguousContainer concept, which would be either std::array, std::string, or std::vector. This way we can utilize std::array internally without exposing the inclusion within the header. --- include/boo/audiodev/MIDIEncoder.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/boo/audiodev/MIDIEncoder.hpp b/include/boo/audiodev/MIDIEncoder.hpp index 693152e..42f3741 100644 --- a/include/boo/audiodev/MIDIEncoder.hpp +++ b/include/boo/audiodev/MIDIEncoder.hpp @@ -1,5 +1,8 @@ #pragma once +#include +#include + #include "boo/audiodev/IMIDIReader.hpp" namespace boo { @@ -8,7 +11,14 @@ template class MIDIEncoder : public IMIDIReader { Sender& m_sender; uint8_t m_status = 0; + void _sendMessage(const uint8_t* data, size_t len); + + template + void _sendMessage(const ContiguousContainer& container) { + _sendMessage(std::data(container), std::size(container)); + } + void _sendContinuedValue(uint32_t val); public: