TTreeReaderArray: [...] vs ->At(...)

Hi all,

there are two methods to access a TTreeReaderArray element: [] and ->At(). Do I assume correctly that these are identical but the second one provides the bounds checking, just like in the case of std::vector? If so, could it be mentioned in the documentation maybe?


Hi @yus,
actually they are identical, you can see their declarations in lines 205 – 208 of TTreeReaderArray.h

   T &At(std::size_t idx) { return *static_cast<T *>(UntypedAt(idx)); }
   const T &At(std::size_t idx) const { return *static_cast<T *>(UntypedAt(idx)); }
   T &operator[](std::size_t idx) { return At(idx); }
   const T &operator[](std::size_t idx) const { return At(idx); }


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.