The problem occurs in Visual Studio 2005 but works in Vc++6.0
rx_fastset.h
struct SortedAppender{
typedef Std:: output_iterator_tag iterator_category;
typedef BASE value_type;
typedef ptrdiff_t difference_type;
typedef BASE* pointer;
typedef BASE& reference;
sortedAppender(FastSet& fastSet): m_fastSet(fastSet) {}
sortedAppender& operator=(value_type v) { m_fastSet.sortedAppend(v); return *this;}
sortedAppender& operator*() { return *this; }
sortedAppender& operator++() { return *this; }
sortedAppender& operator++(int) { return *this; }
FastSet& m_fastSet;
};
rx_vist.cpp
inline void SetUnion(const NodeIdSet& leftSet, const NodeIdSet& rightSet, NodeIdSet& unionSet)
{
assert(unionSet.empty());
std:: set_union(leftSet.begin(), leftSet.end(),
rightSet.begin(), rightSet.end(),
NodeIdSet:: sortedAppender(unionSet));
}
I am getting the following errors..
rx_vist.cpp
c:\program files\microsoft visual studio 8\vc\include\algorithm(3815) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'RX:: FastSet<BASE>:: sortedAppender' (or there is no acceptable conversion)
with
[
BASE=RX::NodeId
]
c:\a\rx_fastset.h(63): could be 'RX::FastSet<BASE>:: sortedAppender &RX:: FastSet<BASE>:: sortedAppender:: operator =(unsigned int)'
with
[
BASE=RX::NodeId
]
while trying to match the argument list '(RX::FastSet<BASE>:: sortedAppender, RX::FastSet<BASE>:: sortedAppender)'
with
[
BASE=RX::NodeId
]
c:\program files\microsoft visual studio 8\vc\include\algorithm(3850) : see reference to function template instantiation '_OutIt std:: _Set_union<std:: _Vector_const_iterator<_Ty,_Alloc>,std::_Vector_const_iterator<_Ty,_Alloc>,_OutIt>(_InIt1,_InIt1,_InIt2,_InIt2,_OutIt,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=RX::FastSet<RX::NodeId>:: sortedAppender,
_Ty=RX::NodeId,
_Alloc=std::allocator<RX::NodeId>,
_InIt1=std::_Vector_const_iterator<RX::NodeId,std::allocator<RX::NodeId>>,
_InIt2=std::_Vector_const_iterator<RX::NodeId,std::allocator<RX::NodeId>>
]
c:\a\rx_vist.cpp(77) : see reference to function template instantiation 'RX::FastSet<BASE>:: sortedAppender std:et_union<std::_Vector_const_iterator<_Ty,_Alloc>,std::_Vector_const_iterator<_Ty,_Alloc>,RX::FastSet<BASE>:: sortedAppender>(_InIt1,_InIt1,_InIt2,_InIt2,_OutIt)' being compiled
with
[
BASE=RX::NodeId,
_Ty=RX::NodeId,
_Alloc=std::allocator<RX::NodeId>,
_InIt1=std::_Vector_const_iterator<RX::NodeId,std::allocator<RX::NodeId>>,
_InIt2=std::_Vector_const_iterator<RX::NodeId,std::allocator<RX::NodeId>>,
_OutIt=RX::FastSet<RX::NodeId>:: sortedAppender
]
c:\program files\microsoft visual studio 8\vc\include\algorithm(3815) : error C2582: 'operator =' function is unavailable in 'RX::FastSet<BASE>:: sortedAppender'
with
[
BASE=RX::NodeId
]
Any help in this would be grateful.