help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Robert Heller
Subject: Confused about template Parameter pack usage (c++-11)
Date: Wed, 12 Dec 2018 11:33:56 -0600

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
heller@deepsoft.com       -- Webhosting Services
                                   


reply via email to

[Prev in Thread] Current Thread [Next in Thread]