Skip to content

Commit

Permalink
Explicit ctor/cast
Browse files Browse the repository at this point in the history
These were highlighted by SonarQube, and they are definitely good to
have. The explicit cast to vector might break some code in the future,
but it's for a good cause, and users can easily add a static_cast into a
vector if they really need the functionality.

Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
  • Loading branch information
rtobar committed Mar 27, 2019
1 parent 9d39870 commit 7ede6ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/profit/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class surface : public surface_base {
typedef typename std::vector<T>::iterator iterator;
typedef typename std::vector<T>::const_iterator const_iterator;

surface(Dimensions dimensions = Dimensions()) :
explicit surface(Dimensions dimensions = Dimensions()) :
surface_base(dimensions),
_data(dimensions.x * dimensions.y)
{
Expand Down Expand Up @@ -394,7 +394,7 @@ class surface : public surface_base {
const_iterator cend() const { return _data.cend(); }

/// type casting to std::vector<T>
operator std::vector<T>() const {
explicit operator std::vector<T>() const {
return std::vector<T>(_data);
}

Expand Down

0 comments on commit 7ede6ab

Please sign in to comment.