warn on unused object access

This commit is contained in:
conrad
2021-06-11 15:31:58 +10:00
parent e6c58ad5b7
commit 76f6f4ff41
2 changed files with 36 additions and 18 deletions
+18 -18
View File
@@ -86,33 +86,33 @@ class field
template<typename oT2>
inline void copy_size(const field<oT2>& x);
arma_inline oT& operator[](const uword i);
arma_inline const oT& operator[](const uword i) const;
arma_inline arma_warn_unused oT& operator[](const uword i);
arma_inline arma_warn_unused const oT& operator[](const uword i) const;
arma_inline oT& at(const uword i);
arma_inline const oT& at(const uword i) const;
arma_inline arma_warn_unused oT& at(const uword i);
arma_inline arma_warn_unused const oT& at(const uword i) const;
arma_inline oT& operator()(const uword i);
arma_inline const oT& operator()(const uword i) const;
arma_inline arma_warn_unused oT& operator()(const uword i);
arma_inline arma_warn_unused const oT& operator()(const uword i) const;
arma_inline oT& at(const uword row, const uword col);
arma_inline const oT& at(const uword row, const uword col) const;
arma_inline arma_warn_unused oT& at(const uword row, const uword col);
arma_inline arma_warn_unused const oT& at(const uword row, const uword col) const;
arma_inline oT& at(const uword row, const uword col, const uword slice);
arma_inline const oT& at(const uword row, const uword col, const uword slice) const;
arma_inline arma_warn_unused oT& at(const uword row, const uword col, const uword slice);
arma_inline arma_warn_unused const oT& at(const uword row, const uword col, const uword slice) const;
arma_inline oT& operator()(const uword row, const uword col);
arma_inline const oT& operator()(const uword row, const uword col) const;
arma_inline arma_warn_unused oT& operator()(const uword row, const uword col);
arma_inline arma_warn_unused const oT& operator()(const uword row, const uword col) const;
arma_inline oT& operator()(const uword row, const uword col, const uword slice);
arma_inline const oT& operator()(const uword row, const uword col, const uword slice) const;
arma_inline arma_warn_unused oT& operator()(const uword row, const uword col, const uword slice);
arma_inline arma_warn_unused const oT& operator()(const uword row, const uword col, const uword slice) const;
arma_inline oT& front();
arma_inline const oT& front() const;
arma_inline arma_warn_unused oT& front();
arma_inline arma_warn_unused const oT& front() const;
arma_inline oT& back();
arma_inline const oT& back() const;
arma_inline arma_warn_unused oT& back();
arma_inline arma_warn_unused const oT& back() const;
arma_cold inline field_injector<field> operator<<(const oT& val);
+18
View File
@@ -470,6 +470,7 @@ field<oT>::copy_size(const field<oT2>& x)
//! linear element accessor (treats the field as a vector); no bounds check
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::operator[] (const uword i)
{
@@ -481,6 +482,7 @@ field<oT>::operator[] (const uword i)
//! linear element accessor (treats the field as a vector); no bounds check
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::operator[] (const uword i) const
{
@@ -492,6 +494,7 @@ field<oT>::operator[] (const uword i) const
//! linear element accessor (treats the field as a vector); no bounds check
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::at(const uword i)
{
@@ -503,6 +506,7 @@ field<oT>::at(const uword i)
//! linear element accessor (treats the field as a vector); no bounds check
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::at(const uword i) const
{
@@ -514,6 +518,7 @@ field<oT>::at(const uword i) const
//! linear element accessor (treats the field as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::operator() (const uword i)
{
@@ -527,6 +532,7 @@ field<oT>::operator() (const uword i)
//! linear element accessor (treats the field as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::operator() (const uword i) const
{
@@ -540,6 +546,7 @@ field<oT>::operator() (const uword i) const
//! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::operator() (const uword in_row, const uword in_col)
{
@@ -553,6 +560,7 @@ field<oT>::operator() (const uword in_row, const uword in_col)
//! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::operator() (const uword in_row, const uword in_col) const
{
@@ -566,6 +574,7 @@ field<oT>::operator() (const uword in_row, const uword in_col) const
//! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::operator() (const uword in_row, const uword in_col, const uword in_slice)
{
@@ -579,6 +588,7 @@ field<oT>::operator() (const uword in_row, const uword in_col, const uword in_sl
//! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::operator() (const uword in_row, const uword in_col, const uword in_slice) const
{
@@ -592,6 +602,7 @@ field<oT>::operator() (const uword in_row, const uword in_col, const uword in_sl
//! element accessor; no bounds check
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::at(const uword in_row, const uword in_col)
{
@@ -603,6 +614,7 @@ field<oT>::at(const uword in_row, const uword in_col)
//! element accessor; no bounds check
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::at(const uword in_row, const uword in_col) const
{
@@ -614,6 +626,7 @@ field<oT>::at(const uword in_row, const uword in_col) const
//! element accessor; no bounds check
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::at(const uword in_row, const uword in_col, const uword in_slice)
{
@@ -625,6 +638,7 @@ field<oT>::at(const uword in_row, const uword in_col, const uword in_slice)
//! element accessor; no bounds check
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::at(const uword in_row, const uword in_col, const uword in_slice) const
{
@@ -635,6 +649,7 @@ field<oT>::at(const uword in_row, const uword in_col, const uword in_slice) cons
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::front()
{
@@ -647,6 +662,7 @@ field<oT>::front()
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::front() const
{
@@ -659,6 +675,7 @@ field<oT>::front() const
template<typename oT>
arma_inline
arma_warn_unused
oT&
field<oT>::back()
{
@@ -671,6 +688,7 @@ field<oT>::back()
template<typename oT>
arma_inline
arma_warn_unused
const oT&
field<oT>::back() const
{