mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
make traits more flexible by splitting out node-related fragment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c8bb37a50a
commit
b141e397d5
@ -69,21 +69,29 @@ struct ilist_sentinel_traits {
|
||||
static void destroySentinel(NodeTy *N) { delete N; }
|
||||
};
|
||||
|
||||
/// ilist_node_traits - A fragment for template traits for intrusive list
|
||||
/// that provides default node related operations.
|
||||
///
|
||||
template<typename NodeTy>
|
||||
struct ilist_node_traits {
|
||||
static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); }
|
||||
static void deleteNode(NodeTy *V) { delete V; }
|
||||
|
||||
void addNodeToList(NodeTy *) {}
|
||||
void removeNodeFromList(NodeTy *) {}
|
||||
void transferNodesFromList(ilist_node_traits & /*SrcTraits*/,
|
||||
ilist_iterator<NodeTy> /*first*/,
|
||||
ilist_iterator<NodeTy> /*last*/) {}
|
||||
};
|
||||
|
||||
/// ilist_default_traits - Default template traits for intrusive list.
|
||||
/// By inheriting from this, you can easily use default implementations
|
||||
/// for all common operations.
|
||||
///
|
||||
template<typename NodeTy>
|
||||
struct ilist_default_traits : ilist_nextprev_traits<NodeTy>,
|
||||
ilist_sentinel_traits<NodeTy> {
|
||||
static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); }
|
||||
static void deleteNode(NodeTy *V) { delete V; }
|
||||
|
||||
void addNodeToList(NodeTy *) {}
|
||||
void removeNodeFromList(NodeTy *) {}
|
||||
void transferNodesFromList(ilist_default_traits & /*SrcTraits*/,
|
||||
ilist_iterator<NodeTy> /*first*/,
|
||||
ilist_iterator<NodeTy> /*last*/) {}
|
||||
ilist_sentinel_traits<NodeTy>,
|
||||
ilist_node_traits<NodeTy> {
|
||||
};
|
||||
|
||||
// Template traits for intrusive list. By specializing this template class, you
|
||||
|
Loading…
Reference in New Issue
Block a user