add noexcept to some functions

This commit is contained in:
Jinhao 2016-11-20 12:04:30 +08:00
parent a6ccc81623
commit 4327ec49a7
3 changed files with 9 additions and 9 deletions

View File

@ -457,8 +457,8 @@ namespace nana
rectangle& pare_off(int pixels); ///<Pares the specified pixels off the rectangle. It's equal to x += pixels; y + pixels; width -= (pixels << 1); height -= (pixels << 1); rectangle& pare_off(int pixels); ///<Pares the specified pixels off the rectangle. It's equal to x += pixels; y + pixels; width -= (pixels << 1); height -= (pixels << 1);
int right() const; int right() const noexcept;
int bottom() const; int bottom() const noexcept;
bool is_hit(int x, int y) const; bool is_hit(int x, int y) const;
bool is_hit(const point& pos) const; bool is_hit(const point& pos) const;
bool empty() const; ///< true if width * height == 0. bool empty() const; ///< true if width * height == 0.

View File

@ -21,12 +21,12 @@ namespace nana
public: public:
virtual ~key_interface(){} virtual ~key_interface(){}
virtual bool same_type(const key_interface*) const = 0; virtual bool same_type(const key_interface*) const noexcept = 0;
virtual bool compare(const key_interface*) const = 0; ///< is this key less than right key? [call it less(rk), less_than(rk) or compare_less(rk)?: if (lk.less_than(rk )) ] virtual bool compare(const key_interface*) const noexcept = 0; ///< is this key less than right key? [call it less(rk), less_than(rk) or compare_less(rk)?: if (lk.less_than(rk )) ]
}; //end class key_interface }; //end class key_interface
//Use less compare for equal compare [call it equal_by_less()?] //Use less compare for equal compare [call it equal_by_less()?]
inline bool pred_equal(const key_interface * left, const key_interface* right) inline bool pred_equal(const key_interface * left, const key_interface* right) noexcept
{ {
return (left->same_type(right) && (left->compare(right) == false) && (right->compare(left) == false)); return (left->same_type(right) && (left->compare(right) == false) && (right->compare(left) == false));
} }
@ -104,12 +104,12 @@ namespace nana
} }
public: public:
//implement key_interface methods //implement key_interface methods
bool same_type(const key_interface * p) const override bool same_type(const key_interface * p) const noexcept override
{ {
return (nullptr != dynamic_cast<const key*>(p)); return (nullptr != dynamic_cast<const key*>(p));
} }
bool compare(const key_interface* p) const override bool compare(const key_interface* p) const noexcept override
{ {
auto rhs = dynamic_cast<const key*>(p); auto rhs = dynamic_cast<const key*>(p);
return rhs && compare_(key_object_, rhs->key_object_); return rhs && compare_(key_object_, rhs->key_object_);

View File

@ -649,12 +649,12 @@ namespace nana
return *this; return *this;
} }
int rectangle::right() const int rectangle::right() const noexcept
{ {
return x + static_cast<int>(width); return x + static_cast<int>(width);
} }
int rectangle::bottom() const int rectangle::bottom() const noexcept
{ {
return y + static_cast<int>(height); return y + static_cast<int>(height);
} }