Код: Выделить всё
template struct node;
template
struct counted_node {
node *data;
long external_count;
};
template
struct node {
struct compressed_counter {
unsigned long internal_counter : 62;
unsigned long head_tail_counter : 2;
};
std::atomic next;
std::atomic internal_counter;
std::atomic value;
};
< /code>
Структура двойного подсчета разработана как < /p>
template struct node;
template
struct counted_node {
node *data;
long external_count;
};
template
struct node {
counted_node next;
std::atomic internal_count;
std::shared_ptr value;
};
Код: Выделить всё
tailПодробнее здесь: https://stackoverflow.com/questions/797 ... nting-used