vendredi 15 février 2019

Specialize member functions based on size of member container

I have a class that holds some statically-sized containers:

template <typename Container>
struct Point {
    Container container;
    ... 
    bar();
}

where a Container class might look like:

struct Container1 {
    static contexpr size_t size = 5;
}

Now I want to specialize the bar method based on the size of the container. I do not understand how to do that.

EDIT:

I would like a C++11 solution. C++14 might work, but the compilers we work with typically have spotty C++14 support.

Aucun commentaire:

Enregistrer un commentaire