Boost.Intrusive

  • 伝統的なリンクリストの構造体をContainer風に操作できる
  • 伝統的なリンクリストはノードポインタを要素に埋め込むことでメモリアクセスの負担を軽くする
  • CPUにとってアクセスが容易なメモリの塊(std::vectorなど)を利用してリンク構造を提供できる
  • Boost.PtrContainerと違ってownershipに関与しない


[]#include[][] <iostream>[]
[]#include[][] <vector>[]
[]#include[][] <boost/intrusive/ilist.hpp>[]
[]#include[][] <boost/range.hpp>[]

[]typedef[] []struct[] []ENEMY[] {
[]struct[] []ENEMY[] *[]prev[];
[]struct[] []ENEMY[] *[]next[];
[]int[] []x[], []y[];
} []ENEMY[];

続きを読む