Reputation: 55
So, on the lower line of presented code I have IntelliSense warning: "No members available". What's wrong? In normal case there appear to be options, like "allocate", "deallocate", etc.
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!
Actually, std::allocator_traits<std::allocator<T>>::
doesn't work too. But works in these case (just as 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
Upvotes: 0
Views: 580
Reputation: 179819
I suspect you want Template Intellisense. Intellisense can give better hints if it has an idea about possible template parameters.
Upvotes: 1