C ++:将dll从VS 2008迁移到VS 2010:错误C2678

时间:2016-07-21 12:37:33

标签: visual-c++ visual-studio-2012

我正在从Visual Studio版本2008到2010迁移使用C ++开发的dll代码。 我面临下面的错误,该错误与'C:\ Program Files \ Microsoft Visual Studio 10.0 \ VC \ include \ xstring'有关。

错误C2678:二元运算符'!=':找不到运算符,该运算符采用'c_allocator< _Ty>'类型的左操作数(或者没有可接受的转换)。

行'class c_allocator:public std :: _ Allocator_base< _Ty> {'。

#include <stdlib.h>
#include <vector>
#include "Synchro.h"
template<class _Ty>
class c_allocator: public std::_Allocator_base<_Ty>{
public:
typedef _Allocator_base<_Ty> _Mybase;
typedef typename _Mybase::value_type value_type;
typedef value_type _FARQ *pointer;
typedef value_type _FARQ& reference;
typedef const value_type _FARQ *const_pointer;
typedef const value_type _FARQ& const_reference;
typedef _SIZT size_type;
typedef _PDFT difference_type;

template<class _Other>struct rebind{
    typedef c_allocator<_Other> other;
};

pointer address(reference _Val) const {
    return (&_Val);
}

const_pointer address(const_reference _Val) const {
    return (&_Val);
}

c_allocator() _THROW0() {
}

c_allocator(const c_allocator<_Ty>&) _THROW0() {
}

template<class _Other>c_allocator(const c_allocator<_Other>&) _THROW0() {
}

template<class _Other>c_allocator<_Ty>& operator=(const c_allocator<_Other>&) {
    return (*this);
}

void deallocate(pointer _Ptr, size_type) {
    CustomAlloc::LinearAllocHolder<1>::alloc.freemem(_Ptr);
}

pointer allocate(size_type _Count) {
    return (pointer)CustomAlloc::LinearAllocHolder<1>::alloc.getmem(_Count*sizeof(value_type));
}

pointer allocate(size_type _Count, const void _FARQ *) {
    return (allocate(_Count));
}

void construct(pointer _Ptr, const _Ty& _Val) {
    std::_Construct(_Ptr, _Val);
}

void destroy(pointer _Ptr) {    
    std::_Destroy(_Ptr);
}

_SIZT max_size() const _THROW0() {
    _SIZT _Count = (_SIZT)(-1) / sizeof (_Ty);
    return (0 < _Count ? _Count : 1);
}
   };

任何提示都非常感激 - 提前致谢 - 剩余

0 个答案:

没有答案