Reputation: 1751
I've been twiddling my thumbs over this one for far too much time now. I am trying to implement a single linked list using two different allocators for both the nodes and the type to which they point. The following code keeps complaining at me that I am partially specializing the friend class declaration within the SingleListNode definition:
namespace containers {
template<typename T, typename TAlloc,
typename NAlloc>class SingleList; // forward declaration
template<typename T, typename TAlloc = std::allocator<T>>
class SingleListNode {
template<typename T1, typename T2, typename T3>
friend class SingleList<T1, T2, T3> ; // partially specialized???
// class definition
};
template<typename T, typename TAlloc = std::allocator<T>,
typename NAlloc = std::allocator<SingleListNode<T>>>
class SingleList {
// class definition
};
} // end of namespace containers
Keeps telling me:
../src/singlelist.h:21:16: error: specialization of ‘template struct containers::SingleList’ must appear at namespace scope ../src/singlelist.h:21:39: error: partial specialization ‘containers::SingleList’ declared ‘friend’
So far as I can tell, this isn't a specialization. Perhaps it is a bug in the GCC compiler? Otherwise, where am I going wrong?
Upvotes: 8
Views: 4656