Skip to content

Commit

Permalink
Appropriate methods were marked as const
Browse files Browse the repository at this point in the history
  • Loading branch information
PocelowannyNebescami committed Jun 20, 2024
1 parent 775d671 commit a88c7b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/eosiolib/contracts/eosio/singleton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace eosio {
* @return true - if exists
* @return false - otherwise
*/
bool exists() {
bool exists() const {
return _t.find( pk_value ) != _t.end();
}

Expand All @@ -72,7 +72,7 @@ namespace eosio {
* @brief Get the value stored inside the singleton table
* @return T - The value stored
*/
T get() {
T get() const {
auto itr = _t.find( pk_value );
eosio::check( itr != _t.end(), "singleton does not exist" );
return itr->value;
Expand All @@ -84,7 +84,7 @@ namespace eosio {
* @param def - The default value to be returned in case the data doesn't exist
* @return T - The value stored
*/
T get_or_default( const T& def = T() ) {
T get_or_default( const T& def = T() ) const {
auto itr = _t.find( pk_value );
return itr != _t.end() ? itr->value : def;
}
Expand Down

0 comments on commit a88c7b8

Please sign in to comment.