expand Base with sum()
This commit is contained in:
@@ -119,6 +119,8 @@ struct Base
|
||||
arma_cold inline void raw_print( const std::string extra_text = "") const;
|
||||
arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
inline arma_warn_unused elem_type sum() const;
|
||||
|
||||
inline arma_warn_unused elem_type min() const;
|
||||
inline arma_warn_unused elem_type max() const;
|
||||
|
||||
|
||||
@@ -81,6 +81,17 @@ Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
elem_type
|
||||
Base<elem_type,derived>::sum() const
|
||||
{
|
||||
return accu( (*this).get_ref() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
|
||||
Reference in New Issue
Block a user