diff options
Diffstat (limited to 'src/db/plugins/simple/Song.hxx')
-rw-r--r-- | src/db/plugins/simple/Song.hxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/db/plugins/simple/Song.hxx b/src/db/plugins/simple/Song.hxx index 75fce20e9..b2e85aa6b 100644 --- a/src/db/plugins/simple/Song.hxx +++ b/src/db/plugins/simple/Song.hxx @@ -20,10 +20,11 @@ #ifndef MPD_SONG_HXX #define MPD_SONG_HXX -#include "util/list.h" #include "tag/Tag.hxx" #include "Compiler.h" +#include <boost/intrusive/list.hpp> + #include <string> #include <assert.h> @@ -39,6 +40,16 @@ class Storage; * #SimpleDatabase class. */ struct Song { + static constexpr auto link_mode = boost::intrusive::normal_link; + typedef boost::intrusive::link_mode<link_mode> LinkMode; + typedef boost::intrusive::list_member_hook<LinkMode> Hook; + + struct Disposer { + void operator()(Song *song) const { + song->Free(); + } + }; + /** * Pointers to the siblings of this directory within the * parent directory. It is unused (undefined) if this song is @@ -47,7 +58,7 @@ struct Song { * This attribute is protected with the global #db_mutex. * Read access in the update thread does not need protection. */ - struct list_head siblings; + Hook siblings; Tag tag; @@ -110,4 +121,9 @@ struct Song { LightSong Export() const; }; +typedef boost::intrusive::list<Song, + boost::intrusive::member_hook<Song, Song::Hook, + &Song::siblings>, + boost::intrusive::constant_time_size<false>> SongList; + #endif |