So, a little background; I'm using Virtual Studio 2017, and learning C++. I've just downloaded a template project to work on, and there's this one specific class, the Enemy class (its a top-down shooter kind of thing), which is causing a super confusing error;
Enemy::Enemy(const Enemy &)': attempting to reference a deleted function
Problem is, this error seems to only occur on the computer I'm working on. The error seems to occur in this class in the xmemory file (where the error log tells me it is), specifically in the fourth-to-last function:
template<class _Alloc>
struct _Default_allocator_traits
{ // traits for std::allocator
using allocator_type = _Alloc;
using value_type = typename _Alloc::value_type;
using pointer = value_type *;
using const_pointer = const value_type *;
using void_pointer = void *;
using const_void_pointer = const void *;
using size_type = size_t;
using difference_type = ptrdiff_t;
using propagate_on_container_copy_assignment = false_type;
using propagate_on_container_move_assignment = true_type;
using propagate_on_container_swap = false_type;
using is_always_equal = true_type;
template<class _Other>
using rebind_alloc = allocator<_Other>;
template<class _Other>
using rebind_traits = allocator_traits<allocator<_Other>>;
_NODISCARD static _DECLSPEC_ALLOCATOR pointer allocate(_Alloc&, _CRT_GUARDOVERFLOW const size_type _Count)
{ // allocate array of _Count elements
return (static_cast<pointer>(_Allocate<_New_alignof<value_type>>(_Get_size_of_n<sizeof(value_type)>(_Count))));
}
_NODISCARD static _DECLSPEC_ALLOCATOR pointer allocate(_Alloc&, _CRT_GUARDOVERFLOW const size_type _Count,
const_void_pointer)
{ // allocate array of _Count elements, with hint
return (static_cast<pointer>(_Allocate<_New_alignof<value_type>>(_Get_size_of_n<sizeof(value_type)>(_Count))));
}
static void deallocate(_Alloc&, const pointer _Ptr, const size_type _Count)
{ // deallocate _Count elements at _Ptr
// no overflow check on the following multiply; we assume _Allocate did that check
_Deallocate<_New_alignof<value_type>>(_Ptr, sizeof(value_type) * _Count);
}
template<class _Objty,
class... _Types>
static void construct(_Alloc&, _Objty * const _Ptr, _Types&&... _Args)
{ // construct _Objty(_Types...) at _Ptr
::new (const_cast<void *>(static_cast<const volatile void *>(_Ptr)))
_Objty(_STD forward<_Types>(_Args)...);
}
template<class _Uty>
static void destroy(_Alloc&, _Uty * const _Ptr)
{ // destroy object at _Ptr
_Ptr->~_Uty();
}
_NODISCARD static size_type max_size(const _Alloc&) _NOEXCEPT
{ // get maximum size
return (static_cast<size_t>(-1) / sizeof(value_type));
}
_NODISCARD static _Alloc select_on_container_copy_construction(const _Alloc& _Al)
{ // get allocator to use
return (_Al);
}
};
Interestingly, this doesn't happen when I make the objects; It happens when I put them in a vector object to store them. Any help would be greatly appreciated!
p.s. I'm putting the tag of Visual Studio 2017 on because it seems this error is similar to some that people have described as "constant vectors vs. vector of constants". The wording, as far as I can tell, is exactly the same.