一种读写可并发进行的队列的实现方法

五.

}
};
};

template
class WriteList
{
LIST& m_list;
public:
typedef typename LIST::value_type value_type;
typedef typename LIST::size_type size_type;
typedef typename LIST::difference_type difference_type;
typedef typename LIST::reference reference;
typedef typename LIST::const_reference const_reference;
typedef typename LIST::pointer pointer;
typedef typename LIST::const_pointer const_pointer;
WriteList(LIST& l): m_list(l)
{
}
void push_back(const_reference data)
{
m_list.push_back(data);
}
bool empty()
{
return m_list.empty();
}
size_type size()
{
return m_list.size();
}
size_type buffer_size()
{
return m_list.buffer_size();
}
};

template
class ReadList
{
LIST& m_list;
public:
typedef typename LIST::value_type value_type;
typedef typename LIST::size_type size_type;
typedef typename LIST::difference_type difference_type;
typedef typename LIST::reference reference;
typedef typename LIST::const_reference const_reference;
typedef typename LIST::pointer pointer;
typedef typename LIST::const_pointer const_pointer;
ReadList(LIST& l): m_list(l)
{
}
void pop_front()
{
m_list.pop_front();
}
reference front()
{
return m_list.front();
}
const_reference front() const
{
return m_list.front();
}
bool empty()
{
return m_list.empty();
}
size_type size()
{
return m_list.size();
}
size_type buffer_size()
{
return m_list.buffer_size();
}
};


#endif

你可能感兴趣的:(并发)