libstdc++: list_update_policy.hpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41#ifndef PB_DS_LU_POLICY_HPP

42#define PB_DS_LU_POLICY_HPP

43

49

51{

52

53

54

55

56

57 template<typename _Alloc = std::allocator<char> >

59 {

60 public:

61 typedef _Alloc allocator_type;

62

63

65

66 public:

67

68 typedef typename detail::rebind_traits<_Alloc, metadata_type>::reference

70

71

74 { return s_metadata; }

75

76

77

78 inline bool

80 { return true; }

81

82 private:

84 };

85

86

87

88

89

90 template<std::size_t Max_Count = 5, typename _Alloc = std::allocator<char> >

93 {

94 public:

95 typedef _Alloc allocator_type;

96 typedef typename allocator_type::size_type size_type;

97

98 enum

99 {

100

101

104

105

107

108 private:

110

111 public:

112

113 typedef typename detail::rebind_traits<_Alloc, metadata_type>::reference

115

116

119 { return base_type::operator()(max_count); }

120

121

122

123 bool

125 { return base_type::operator()(r_data, max_count); }

126 };

127}

128

129#endif

GNU extensions for policy-based data structures for public use.

bool operator()(metadata_reference r_metadata) const

Decides whether a metadata object should be moved to the front of the list.

detail::rebind_traits< _Alloc, metadata_type >::reference metadata_reference

Reference to metadata on which this functor operates.

null_type metadata_type

Metadata on which this functor operates.

metadata_type operator()() const

Creates a metadata object.

detail::rebind_traits< _Alloc, metadata_type >::reference metadata_reference

Reference to metadata on which this functor operates.

detail::lu_counter_metadata< size_type > metadata_type

Metadata on which this functor operates.

metadata_type operator()() const

Creates a metadata object.

@ max_count

When some element is accessed this number of times, it will be moved to the front of the list.

bool operator()(metadata_reference r_data) const

Decides whether a metadata object should be moved to the front of the list.

Represents no type, or absence of type, for template tricks.

Base class for list-update counter policy.

A list-update metadata type that moves elements to the front of the list based on the counter algorit...