samedi 17 août 2019

Vector with custom allocator gives a compilation error

I'm trying to define a vector with custom allocator as follows:

template <typename T> using FasterVector = std::vector<T, MPAllocator<T>>;

However, when I try to use it at global scope as follows:

namespace {
  FasterVector<Mediator> gMediators; // line #18
}

I get the following compilation errors:

1>neststochclient.cpp(18): error C2143: syntax error: missing ';' before '<'
1>neststochclient.cpp(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

The compiler is MSCV++2017 with language standard set to "Latest Draft".

Could you help me to solve this?

Aucun commentaire:

Enregistrer un commentaire