Changeset 4a7e47b in mainline for uspace/lib/cpp/include/impl/list.hpp


Ignore:
Timestamp:
2018-07-05T21:41:21Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e29ce3d
Parents:
3d6f7f3
git-author:
Dzejrou <dzejrou@…> (2018-04-22 15:50:54)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:21)
Message:

cpp: moved list_node to an auxiliary header as it will be used in hash maps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/impl/list.hpp

    r3d6f7f3 r4a7e47b  
    3131
    3232#include <cstdlib>
     33#include <internal/list.hpp>
    3334#include <iterator>
    3435#include <memory>
     
    4243    namespace aux
    4344    {
    44         template<class T>
    45         struct list_node
    46         {
    47             T value;
    48             list_node* next;
    49             list_node* prev;
    50 
    51             template<class... Args>
    52             list_node(Args&&... args)
    53                 : value{forward<Args>(args)...},
    54                   next{}, prev{}
    55             {
    56                 next = this;
    57                 prev = this;
    58             }
    59 
    60             list_node(const T& val)
    61                 : value{val}, next{}, prev{}
    62             {
    63                 next = this;
    64                 prev = this;
    65             }
    66 
    67             list_node(T&& val)
    68                 : value{forward<T>(val)}, next{}, prev{}
    69             {
    70                 next = this;
    71                 prev = this;
    72             }
    73 
    74             void append(list_node* node)
    75             {
    76                 node->next = next;
    77                 node->prev = this;
    78                 next->prev = node;
    79                 next = node;
    80             }
    81 
    82             void prepend(list_node* node)
    83             {
    84                 node->next = this;
    85                 node->prev = prev;
    86                 prev->next = node;
    87                 prev = node;
    88             }
    89 
    90             void unlink()
    91             {
    92                 prev->next = next;
    93                 next->prev = prev;
    94             }
    95         };
    96 
    9745        template<class T>
    9846        class list_const_iterator
Note: See TracChangeset for help on using the changeset viewer.