我是否需要通过锁来保护对 Boost MultiIndex 索引(索引本身)的访问?

Do I need to protect access to a Boost MultiIndex's index (the index itself) by a lock?

假设我有一个 boost::multi_index_container 并且想要访问它的索引

  boost::multi_index_container< ... > bmi;
  // lock here?
  auto &index = boost::multi_index::get<0>(bmi);   // <-- does this call need to be protected by a lock?

  // or is it sufficient to lock here?

  // access the index (need to have the lock here)

当多个进程/线程访问一个 multi_indesx_container 时,我需要使用互斥锁(或类似的东西)。但是我是否也需要保护获取索引本身? 我猜不是,但无法在文档中找到保证。

虽然在任何地方都没有记录,get() 是一个 static cast operation,本质上是线程安全的。