samedi 28 juillet 2018

explicit instantiation: why doesn't work

Here is a simple code:

#include <iostream>
#include <array>

using namespace std;

class cl {
public:
  template <int N, typename ExtractedType>
            bool ExtractDataFromArray(std::array<uint8_t, N> &ExtractFrom,
                                      uint8_t StartBit, uint8_t BitLen, ExtractedType
                                      &out);
};

template <int N, typename ExtractedType>
bool cl::ExtractDataFromArray(std::array<uint8_t, 8> &ExtractFrom,
                          uint8_t StartBit, uint8_t BitLen, ExtractedType
                          &out) { return false;}

template
bool cl::ExtractDataFromArray<2, int>(std::array<uint8_t, 8> &ExtractFrom,
                          uint8_t StartBit, uint8_t BitLen, int &out);

Why it refuses to instantiate ExtractDataFromArray for pair <8, int>?

Aucun commentaire:

Enregistrer un commentaire