Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Confused about template Parameter pack usage (c++-11)

2 views
Skip to first unread message

Robert Heller

unread,
Dec 12, 2018, 12:34:01 PM12/12/18
to
I am trying to create a template class that is a container of sorts for some
fixed number of another ("normal") class. This is what I have, and it compiles
with gcc version 4.9.2 (Raspbian 4.9.2-10+deb8u1), but I am unsure if it is
just what I want):

template <int N>class ht16K33_5x7_gang : public Adafruit_GFX {
public:
ht16K33_5x7_gang();
template <uint8_t... > void begin(uint8_t...);
size_t write(uint8_t c);
size_t write(uint8_t c, uint8_t p);
void drawPixel(int16_t x, int16_t y, uint16_t color);
private:
ht16K33_5x7 gangMembers[N];
uint8_t position;
};

Right now, my problem is with the begin() function. I would like it to have
*exactly* N uint8_t arguments, but I don't know how to do that exactly (or
even if it is possible).

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

0 new messages