X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fintrusive_list.h;h=5f55591c7731e41e6d70cbcdc932ef652dd25801;hb=405396945a7a3f8f120ad71386b039edfcae0657;hp=ae323edb8e62868933f61a9710406477dbe98986;hpb=7282c2250e02c3ea2da57508d885c09c9881c4f0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/intrusive_list.h b/include/intrusive_list.h index ae323edb8..5f55591c7 100644 --- a/include/intrusive_list.h +++ b/include/intrusive_list.h @@ -1,7 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2013-2014 Attila Molnar + * Copyright (C) 2014 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -21,9 +21,13 @@ #include +namespace insp +{ + struct intrusive_list_def_tag { }; template class intrusive_list; +template class intrusive_list_tail; template class intrusive_list_node @@ -48,6 +52,20 @@ class intrusive_list_node } friend class intrusive_list; + friend class intrusive_list_tail; }; +} // namespace insp + +// Intrusive list where the list only has a pointer to the head element +#define INSPIRCD_INTRUSIVE_LIST_NAME intrusive_list +#include "intrusive_list_impl.h" +#undef INSPIRCD_INTRUSIVE_LIST_NAME + +// Intrusive list where the list maintains a pointer to both the head and the tail elements. +// Additional methods: back(), push_back(), pop_back() +#define INSPIRCD_INTRUSIVE_LIST_NAME intrusive_list_tail +#define INSPIRCD_INTRUSIVE_LIST_HAS_TAIL #include "intrusive_list_impl.h" +#undef INSPIRCD_INTRUSIVE_LIST_NAME +#undef INSPIRCD_INTRUSIVE_LIST_HAS_TAIL