分配器:"No members available"。我该如何解决?

Allocators: "No members available". How can I fix that?

因此,在所提供代码的下一行,我有 IntelliSense 警告:"No members available"。怎么了?在正常情况下,似乎有选项,如 "allocate"、"deallocate" 等

namespace MyLib
{
    template <typename T,
        template <typename Y> class Allocator = std::allocator>
    class Vector
    {
    private:
        std::size_t capacityV;
        std::size_t sizeV;
        T* arr;
    public:
        typedef Allocator<T> AllocatorType;
        typedef Vector<T, Allocator> VectorType;
        template<typename T>
        using AllocTraits = std::allocator_traits<Allocator<T>>;

        std::allocator_traits<Allocator<T>>::    //HERE!

其实,std::allocator_traits<std::allocator<T>>::也行不通。但在这些情况下有效(就像 std::allocator_traits<Allocator<T>>::):

template <
    typename T,
    template <typename Y> class Allocator = std::allocator> // use std::allocator as default allocator
std::unique_ptr<T, std::function<void(T*)>> move_with_allocator(
    T&& stack_object, Allocator<T> allocator = Allocator<T>())
{
    using AllocTraits = std::allocator_traits<Allocator<T>>;
    std::allocator_traits<std::allocator<T>>::allocate(allocator, 1);    //WORKING FINE HERE

Visual Studio 2019

我怀疑你想要 Template Intellisense。如果 Intellisense 知道可能的模板参数,它可以提供更好的提示。