Skip to content

Commit 98d4d9e

Browse files
committed
[math] Add data() and size() methods to TVectorT
This is to allow implicit conversion to `std::span`.
1 parent eddd42f commit 98d4d9e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

math/matrix/inc/TVectorT.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ template<class Element> class TVectorT : public TObject {
7676
inline Element *GetMatrixArray () { return fElements; }
7777
inline const Element *GetMatrixArray () const { return fElements; }
7878

79+
// For compatibility with STL classes
80+
inline std::size_t size() const { return fNrows; }
81+
82+
inline Element *data() { return fElements; }
83+
inline const Element *data() const { return fElements; }
84+
7985
inline void Invalidate () { SetBit(kStatus); }
8086
inline void MakeValid () { ResetBit(kStatus); }
8187
inline Bool_t IsValid () const { return !TestBit(kStatus); }

0 commit comments

Comments
 (0)