Кресты / Говнокод #26054 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
template<typename T> Histogram<T>& histogram (std::string const& name) {
    std::lock_guard<std::mutex> guard(_lock);
    auto const it = _registry.find(name);
    if (it == _registry.end()) {
      LOG_TOPIC("32d85", ERR, Logger::STATISTICS) << "No histogram booked as " << name;
      TRI_ASSERT(false);
      throw std::exception();
    } 
    std::shared_ptr<Histogram<T>> h = nullptr;
    try {
      h = std::dynamic_pointer_cast<Histogram<T>>(*it->second);
      if (h == nullptr) {
        LOG_TOPIC("d2358", ERR, Logger::STATISTICS) << "Failed to retrieve histogram " << name;
      }
    } catch (std::exception const& e) {
      LOG_TOPIC("32d75", ERR, Logger::STATISTICS)
        << "Failed to retrieve histogram " << name << ": " << e.what();
    }
    if (h == nullptr) {
      TRI_ASSERT(false);
    }

    return *h;
  };

Запостил: gnusmas gnusmas, (Updated )

Комментарии (1) RSS

Добавить комментарий

Где здесь C++, guest?!

    А не использовать ли нам bbcode?


    8