diff --git a/src/AbstractFramebuffer.h b/src/AbstractFramebuffer.h index a18b1f303..542e00a12 100644 --- a/src/AbstractFramebuffer.h +++ b/src/AbstractFramebuffer.h @@ -182,7 +182,7 @@ class MAGNUM_EXPORT AbstractFramebuffer { blit(source, destination, bottomLeft, topRight, bottomLeft, topRight, mask, BlitFilter::NearestNeighbor); } - AbstractFramebuffer() = default; + explicit AbstractFramebuffer() = default; virtual ~AbstractFramebuffer() = 0; /** diff --git a/src/AbstractImage.h b/src/AbstractImage.h index 594d43cd5..8eb821569 100644 --- a/src/AbstractImage.h +++ b/src/AbstractImage.h @@ -436,7 +436,7 @@ class MAGNUM_EXPORT AbstractImage { * @param format Format of pixel data * @param type Data type of pixel data */ - inline AbstractImage(Format format, Type type): _format(format), _type(type) {} + inline explicit AbstractImage(Format format, Type type): _format(format), _type(type) {} /** @brief Destructor */ virtual ~AbstractImage() = 0; diff --git a/src/AbstractResourceLoader.h b/src/AbstractResourceLoader.h index 01c68a2b5..e1d358215 100644 --- a/src/AbstractResourceLoader.h +++ b/src/AbstractResourceLoader.h @@ -91,7 +91,7 @@ template class AbstractResourceLoader { friend class Implementation::ResourceManagerData; public: - inline AbstractResourceLoader(): manager(nullptr), _requestedCount(0), _loadedCount(0), _notFoundCount(0) {} + inline explicit AbstractResourceLoader(): manager(nullptr), _requestedCount(0), _loadedCount(0), _notFoundCount(0) {} inline virtual ~AbstractResourceLoader() { if(manager) manager->_loader = nullptr; diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h index 1f6f60d60..10d48afe0 100644 --- a/src/AbstractShaderProgram.h +++ b/src/AbstractShaderProgram.h @@ -455,7 +455,7 @@ class MAGNUM_EXPORT AbstractShaderProgram { * Creates one OpenGL shader program. * @see @fn_gl{CreateProgram} */ - inline AbstractShaderProgram(): state(Initialized) { + inline explicit AbstractShaderProgram(): state(Initialized) { _id = glCreateProgram(); } diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h index 9145e8119..31d8f916c 100644 --- a/src/AbstractTexture.h +++ b/src/AbstractTexture.h @@ -974,7 +974,7 @@ class MAGNUM_EXPORT AbstractTexture { * Creates one OpenGL texture. * @see @fn_gl{GenTextures} */ - inline AbstractTexture(GLenum target): _target(target) { + inline explicit AbstractTexture(GLenum target): _target(target) { glGenTextures(1, &_id); } diff --git a/src/Array.h b/src/Array.h index fc940fc7e..e761dde90 100644 --- a/src/Array.h +++ b/src/Array.h @@ -45,7 +45,7 @@ template class Array { * * Sets all components to their default-constructed values */ - inline constexpr Array(): _data() {} + inline constexpr /*implicit*/ Array(): _data() {} /** * @brief Initializer-list constructor @@ -53,19 +53,19 @@ template class Array { * @param next Next values */ #ifndef DOXYGEN_GENERATING_OUTPUT - template inline constexpr Array(T first, T second, U... next): _data{first, second, next...} { + template inline constexpr /*implicit*/ Array(T first, T second, U... next): _data{first, second, next...} { static_assert(sizeof...(next)+2 == dimensions, "Improper number of arguments passed to Array constructor"); } - template inline constexpr Array(typename std::enable_if::value && dimensions == 1, U>::type first): _data{first} {} + template inline constexpr /*implicit*/ Array(typename std::enable_if::value && dimensions == 1, U>::type first): _data{first} {} #else - template inline constexpr Array(T first, U... next); + template inline constexpr /*implicit*/ Array(T first, U... next); #endif /** * @brief Constructor * @param value Value for all fields */ - template::value && dimensions != 1, U>::type> inline Array(U value) { + template::value && dimensions != 1, U>::type> inline /*implicit*/ Array(U value) { for(std::uint8_t i = 0; i != dimensions; ++i) _data[i] = value; } @@ -104,13 +104,13 @@ template class Array { template class Array1D: public Array<1, T> { public: /** @copydoc Array::Array() */ - inline constexpr Array1D() = default; + inline constexpr /*implicit*/ Array1D() = default; /** * @brief Constructor * @param x X component */ - inline constexpr Array1D(T x): Array<1, T>(x) {} + inline constexpr /*implicit*/ Array1D(T x): Array<1, T>(x) {} /** @brief Copy constructor */ inline constexpr Array1D(const Array<1, T>& other): Array<1, T>(other) {} @@ -126,17 +126,17 @@ template class Array1D: public Array<1, T> { template class Array2D: public Array<2, T> { public: /** @copydoc Array::Array() */ - inline constexpr Array2D() = default; + inline constexpr /*implicit*/ Array2D() = default; /** * @brief Constructor * @param x X component * @param y Y component */ - inline constexpr Array2D(T x, T y): Array<2, T>(x, y) {} + inline constexpr /*implicit*/ Array2D(T x, T y): Array<2, T>(x, y) {} /** @copydoc Array::Array(U) */ - inline constexpr Array2D(T value): Array<2, T>(value, value) {} + inline constexpr /*implicit*/ Array2D(T value): Array<2, T>(value, value) {} /** @brief Copy constructor */ inline constexpr Array2D(const Array<2, T>& other): Array<2, T>(other) {} @@ -154,7 +154,7 @@ template class Array2D: public Array<2, T> { template class Array3D: public Array<3, T> { public: /** @copydoc Array::Array() */ - inline constexpr Array3D() {} + inline constexpr /*implicit*/ Array3D() {} /** * @brief Constructor @@ -162,10 +162,10 @@ template class Array3D: public Array<3, T> { * @param y Y component * @param z Z component */ - inline constexpr Array3D(T x, T y, T z): Array<3, T>(x, y, z) {} + inline constexpr /*implicit*/ Array3D(T x, T y, T z): Array<3, T>(x, y, z) {} /** @copydoc Array::Array(U) */ - inline constexpr Array3D(T value): Array<3, T>(value, value, value) {} + inline constexpr /*implicit*/ Array3D(T value): Array<3, T>(value, value, value) {} /** @brief Copy constructor */ inline constexpr Array3D(const Array<3, T>& other): Array<3, T>(other) {} diff --git a/src/Buffer.h b/src/Buffer.h index 2e22375e9..91ca36587 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -311,7 +311,7 @@ class MAGNUM_EXPORT Buffer { * Generates new OpenGL buffer. * @see @fn_gl{GenBuffers} */ - inline Buffer(Target targetHint = Target::Array): _targetHint(targetHint) { + inline explicit Buffer(Target targetHint = Target::Array): _targetHint(targetHint) { glGenBuffers(1, &_id); } diff --git a/src/BufferImage.h b/src/BufferImage.h index a9c35abcf..63911d2b8 100644 --- a/src/BufferImage.h +++ b/src/BufferImage.h @@ -49,7 +49,7 @@ template class MAGNUM_EXPORT BufferImage: public Abstra * Dimensions and buffer are empty, call setData() to fill the image * with data. */ - inline BufferImage(Format format, Type type): AbstractImage(format, type) { + inline explicit BufferImage(Format format, Type type): AbstractImage(format, type) { _buffer.setTargetHint(Buffer::Target::PixelPack); } diff --git a/src/BufferTexture.h b/src/BufferTexture.h index bdb98656e..37cc3c9a1 100644 --- a/src/BufferTexture.h +++ b/src/BufferTexture.h @@ -194,7 +194,7 @@ class MAGNUM_EXPORT BufferTexture: private AbstractTexture { RGBA32F = GL_RGBA32F }; - inline BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} + inline explicit BufferTexture(): AbstractTexture(GL_TEXTURE_BUFFER) {} /** @copydoc AbstractTexture::bind() */ inline void bind(GLint layer) { AbstractTexture::bind(layer); } diff --git a/src/Color.h b/src/Color.h index 5b8bb83aa..23fabeb99 100644 --- a/src/Color.h +++ b/src/Color.h @@ -211,7 +211,7 @@ class Color3: public Math::Vector3 { * * All components are set to zero. */ - inline constexpr Color3() {} + inline constexpr /*implicit*/ Color3() {} /** * @brief Gray constructor @@ -219,16 +219,16 @@ class Color3: public Math::Vector3 { */ inline constexpr explicit Color3(T rgb): Math::Vector3(rgb) {} - /** @brief Copy constructor */ - inline constexpr Color3(const Math::RectangularMatrix<1, 3, T>& other): Math::Vector3(other) {} - /** * @brief Constructor * @param r R value * @param g G value * @param b B value */ - inline constexpr Color3(T r, T g, T b): Math::Vector3(r, g, b) {} + inline constexpr /*implicit*/ Color3(T r, T g, T b): Math::Vector3(r, g, b) {} + + /** @brief Copy constructor */ + inline constexpr Color3(const Math::RectangularMatrix<1, 3, T>& other): Math::Vector3(other) {} inline T& r() { return Math::Vector3::x(); } /**< @brief R component */ inline constexpr T r() const { return Math::Vector3::x(); } /**< @overload */ @@ -343,7 +343,7 @@ class Color4: public Math::Vector4 { * RGB components are set to zero, A component is set to 1.0 for * floating-point types and maximum positive value for integral types. */ - inline constexpr Color4(): Math::Vector4(T(0), T(0), T(0), Implementation::defaultAlpha()) {} + inline constexpr /*implicit*/ Color4(): Math::Vector4(T(0), T(0), T(0), Implementation::defaultAlpha()) {} /** * @copydoc Color3::Color3(T) @@ -352,9 +352,6 @@ class Color4: public Math::Vector4 { */ inline constexpr explicit Color4(T rgb, T alpha = Implementation::defaultAlpha()): Math::Vector4(rgb, rgb, rgb, alpha) {} - /** @brief Copy constructor */ - inline constexpr Color4(const Math::RectangularMatrix<1, 4, T>& other): Math::Vector4(other) {} - /** * @brief Constructor * @param r R value @@ -363,7 +360,7 @@ class Color4: public Math::Vector4 { * @param a A value, defaults to 1.0 for floating-point types and * maximum positive value for integral types. */ - inline constexpr Color4(T r, T g, T b, T a = Implementation::defaultAlpha()): Math::Vector4(r, g, b, a) {} + inline constexpr /*implicit*/ Color4(T r, T g, T b, T a = Implementation::defaultAlpha()): Math::Vector4(r, g, b, a) {} /** * @brief Constructor @@ -372,7 +369,10 @@ class Color4: public Math::Vector4 { */ /* Not marked as explicit, because conversion from Color3 to Color4 is fairly common, nearly always with A set to 1 */ - inline constexpr Color4(const Math::Vector3& rgb, T a = Implementation::defaultAlpha()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + inline constexpr /*implicit*/ Color4(const Math::Vector3& rgb, T a = Implementation::defaultAlpha()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + + /** @brief Copy constructor */ + inline constexpr Color4(const Math::RectangularMatrix<1, 4, T>& other): Math::Vector4(other) {} inline T& r() { return Math::Vector4::x(); } /**< @brief R component */ inline constexpr T r() const { return Math::Vector4::x(); } /**< @overload */ diff --git a/src/Context.h b/src/Context.h index b2bf161c8..53c8b7896 100644 --- a/src/Context.h +++ b/src/Context.h @@ -143,7 +143,7 @@ class MAGNUM_EXPORT Context { * @see @fn_gl{Get} with @def_gl{MAJOR_VERSION}, @def_gl{MINOR_VERSION}, * @fn_gl{GetString} with @def_gl{EXTENSIONS} */ - Context(); + explicit Context(); ~Context(); diff --git a/src/CubeMapTexture.h b/src/CubeMapTexture.h index c6d2da991..e53fa92ba 100644 --- a/src/CubeMapTexture.h +++ b/src/CubeMapTexture.h @@ -97,7 +97,7 @@ class CubeMapTexture: public AbstractTexture { * Creates one cube map OpenGL texture. * @see @def_gl{TEXTURE_CUBE_MAP} */ - inline CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {} + inline explicit CubeMapTexture(): AbstractTexture(GL_TEXTURE_CUBE_MAP) {} /** * @copydoc Texture::setWrapping() diff --git a/src/CubeMapTextureArray.h b/src/CubeMapTextureArray.h index abda57b71..ef5fe0124 100644 --- a/src/CubeMapTextureArray.h +++ b/src/CubeMapTextureArray.h @@ -87,7 +87,7 @@ class CubeMapTextureArray: public AbstractTexture { * Creates one cube map OpenGL texture. * @see @def_gl{TEXTURE_CUBE_MAP_ARRAY} */ - inline CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {} + inline explicit CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {} /** * @copydoc Texture::setWrapping() diff --git a/src/DefaultFramebuffer.h b/src/DefaultFramebuffer.h index 1798c4138..4578d6200 100644 --- a/src/DefaultFramebuffer.h +++ b/src/DefaultFramebuffer.h @@ -164,7 +164,7 @@ class MAGNUM_EXPORT DefaultFramebuffer: public AbstractFramebuffer { #endif }; - MAGNUM_LOCAL DefaultFramebuffer(); + explicit MAGNUM_LOCAL DefaultFramebuffer(); #ifndef MAGNUM_TARGET_GLES2 /** diff --git a/src/Framebuffer.h b/src/Framebuffer.h index 6ab19eec1..a146dd6dc 100644 --- a/src/Framebuffer.h +++ b/src/Framebuffer.h @@ -38,7 +38,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer { * Generates new OpenGL framebuffer. * @see @fn_gl{GenFramebuffers} */ - Framebuffer(const Vector2i& viewportPosition, const Vector2i& viewportSize); + explicit Framebuffer(const Vector2i& viewportPosition, const Vector2i& viewportSize); /** * @brief Destructor diff --git a/src/Image.h b/src/Image.h index 8146ce13b..111a748f7 100644 --- a/src/Image.h +++ b/src/Image.h @@ -46,7 +46,7 @@ template class Image: public AbstractImage { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - inline Image(const typename DimensionTraits::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} + inline explicit Image(const typename DimensionTraits::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} /** * @brief Constructor @@ -56,7 +56,7 @@ template class Image: public AbstractImage { * Dimensions and data pointer are set to zero, call setData() to fill * the image with data. */ - inline Image(Format format, Type type): AbstractImage(format, type), _data(nullptr) {} + inline explicit Image(Format format, Type type): AbstractImage(format, type), _data(nullptr) {} /** @brief Destructor */ inline ~Image() { delete[] _data; } diff --git a/src/ImageWrapper.h b/src/ImageWrapper.h index 6deb82bc2..c3a5046b5 100644 --- a/src/ImageWrapper.h +++ b/src/ImageWrapper.h @@ -53,7 +53,7 @@ template class ImageWrapper: public AbstractImage { * Note that the image data are not copied on construction, but they * are deleted on class destruction. */ - inline ImageWrapper(const typename DimensionTraits::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} + inline explicit ImageWrapper(const typename DimensionTraits::VectorType& size, Format format, Type type, GLvoid* data): AbstractImage(format, type), _size(size), _data(reinterpret_cast(data)) {} /** * @brief Constructor @@ -64,7 +64,7 @@ template class ImageWrapper: public AbstractImage { * Dimensions and data pointer are set to zero, call setData() to fill * the image with data. */ - inline ImageWrapper(const typename DimensionTraits::VectorType& size, Format format, Type type): AbstractImage(format, type), _size(size), _data(nullptr) {} + inline explicit ImageWrapper(const typename DimensionTraits::VectorType& size, Format format, Type type): AbstractImage(format, type), _size(size), _data(nullptr) {} /** @brief %Image size */ inline typename DimensionTraits::VectorType size() const { return _size; } diff --git a/src/IndexedMesh.h b/src/IndexedMesh.h index 9e6e3f6b3..d801255e6 100644 --- a/src/IndexedMesh.h +++ b/src/IndexedMesh.h @@ -80,7 +80,7 @@ class MAGNUM_EXPORT IndexedMesh: public Mesh { * @see setPrimitive(), setVertexCount(), setIndexBuffer(), * setIndexCount(), setIndexType() */ - inline IndexedMesh(Primitive primitive = Primitive::Triangles): Mesh(primitive), _indexBuffer(nullptr), _indexCount(0), _indexType(Type::UnsignedShort) {} + inline explicit IndexedMesh(Primitive primitive = Primitive::Triangles): Mesh(primitive), _indexBuffer(nullptr), _indexCount(0), _indexType(Type::UnsignedShort) {} /** * @brief Set index buffer diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index a773af055..66235ef99 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -62,7 +62,7 @@ template class Matrix: public RectangularMatrix class Matrix: public RectangularMatrix inline constexpr Matrix(T first, U... next): RectangularMatrix(first, next...) {} + template inline constexpr /*implicit*/ Matrix(T first, U... next): RectangularMatrix(first, next...) {} #else - template inline constexpr Matrix(T first, U... next); + template inline constexpr /*implicit*/ Matrix(T first, U... next); #endif /** @brief Copy constructor */ diff --git a/src/Math/Matrix3.h b/src/Math/Matrix3.h index 59ba6b48c..20910638d 100644 --- a/src/Math/Matrix3.h +++ b/src/Math/Matrix3.h @@ -87,7 +87,7 @@ template class Matrix3: public Matrix<3, T> { inline constexpr explicit Matrix3(typename Matrix<3, T>::ZeroType): Matrix<3, T>(Matrix<3, T>::Zero) {} /** @copydoc Matrix::Matrix(IdentityType, T) */ - inline constexpr Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>( + inline constexpr /*implicit*/ Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>( value, T(0), T(0), T(0), value, T(0), T(0), T(0), value @@ -95,9 +95,9 @@ template class Matrix3: public Matrix<3, T> { /** @copydoc Matrix::Matrix */ #ifndef DOXYGEN_GENERATING_OUTPUT - template inline constexpr Matrix3(T first, U... next): Matrix<3, T>(first, next...) {} + template inline constexpr /*implicit*/ Matrix3(T first, U... next): Matrix<3, T>(first, next...) {} #else - template inline constexpr Matrix3(T first, U... next) {} + template inline constexpr /*implicit*/ Matrix3(T first, U... next) {} #endif /** @brief Copy constructor */ diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index 9e01c2104..899374fa7 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -177,7 +177,7 @@ template class Matrix4: public Matrix<4, T> { inline constexpr explicit Matrix4(typename Matrix<4, T>::ZeroType): Matrix<4, T>(Matrix<4, T>::Zero) {} /** @copydoc Matrix::Matrix(IdentityType, T) */ - inline constexpr Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>( + inline constexpr /*implicit*/ Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>( value, T(0), T(0), T(0), T(0), value, T(0), T(0), T(0), T(0), value, T(0), @@ -186,9 +186,9 @@ template class Matrix4: public Matrix<4, T> { /** @copydoc Matrix::Matrix */ #ifndef DOXYGEN_GENERATING_OUTPUT - template inline constexpr Matrix4(T first, U... next): Matrix<4, T>(first, next...) {} + template inline constexpr /*implicit*/ Matrix4(T first, U... next): Matrix<4, T>(first, next...) {} #else - template inline constexpr Matrix4(T first, U... next) {} + template inline constexpr /*implicit*/ Matrix4(T first, U... next) {} #endif /** @brief Copy constructor */ diff --git a/src/Math/Point2D.h b/src/Math/Point2D.h index f26552d77..93adf7d9f 100644 --- a/src/Math/Point2D.h +++ b/src/Math/Point2D.h @@ -39,10 +39,7 @@ template class Point2D: public Vector3 { * * X and Y components are set to zero, Z is set to one. */ - inline constexpr Point2D(): Vector3(T(0), T(0), T(1)) {} - - /** @brief Copy constructor */ - inline constexpr Point2D(const RectangularMatrix<1, 3, T>& other): Vector3(other) {} + inline constexpr /*implicit*/ Point2D(): Vector3(T(0), T(0), T(1)) {} /** * @brief Constructor @@ -50,14 +47,17 @@ template class Point2D: public Vector3 { * @param y Y component * @param z Z component */ - inline constexpr Point2D(T x, T y, T z = T(1)): Vector3(x, y, z) {} + inline constexpr /*implicit*/ Point2D(T x, T y, T z = T(1)): Vector3(x, y, z) {} /** * @brief Constructor * @param xy Two-component vector * @param z Z component */ - inline constexpr Point2D(const Vector2& xy, T z = T(1)): Vector3(xy, z) {} + inline constexpr /*implicit*/ Point2D(const Vector2& xy, T z = T(1)): Vector3(xy, z) {} + + /** @brief Copy constructor */ + inline constexpr Point2D(const RectangularMatrix<1, 3, T>& other): Vector3(other) {} /** * @brief Vector part of the point diff --git a/src/Math/Point3D.h b/src/Math/Point3D.h index 339822217..959b7e745 100644 --- a/src/Math/Point3D.h +++ b/src/Math/Point3D.h @@ -39,10 +39,7 @@ template class Point3D: public Vector4 { * * X, Y and Z components are set to zero, W is set to one. */ - inline constexpr Point3D(): Vector4(T(0), T(0), T(0), T(1)) {} - - /** @brief Copy constructor */ - inline constexpr Point3D(const RectangularMatrix<1, 4, T>& other): Vector4(other) {} + inline constexpr /*implicit*/ Point3D(): Vector4(T(0), T(0), T(0), T(1)) {} /** * @brief Constructor @@ -51,14 +48,17 @@ template class Point3D: public Vector4 { * @param z Z component * @param w W component */ - inline constexpr Point3D(T x, T y, T z, T w = T(1)): Vector4(x, y, z, w) {} + inline constexpr /*implicit*/ Point3D(T x, T y, T z, T w = T(1)): Vector4(x, y, z, w) {} /** * @brief Constructor * @param xyz Three-component vector * @param w W component */ - inline constexpr Point3D(const Vector3& xyz, T w = T(1)): Vector4(xyz, w) {} + inline constexpr /*implicit*/ Point3D(const Vector3& xyz, T w = T(1)): Vector4(xyz, w) {} + + /** @brief Copy constructor */ + inline constexpr Point3D(const RectangularMatrix<1, 4, T>& other): Vector4(other) {} /** * @brief Vector part of the point diff --git a/src/Math/RectangularMatrix.h b/src/Math/RectangularMatrix.h index d4a2bb7e0..7ff919cb2 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Math/RectangularMatrix.h @@ -116,7 +116,7 @@ template class RectangularMatrix { } /** @brief Zero-filled matrix constructor */ - inline constexpr RectangularMatrix(): _data() {} + inline constexpr /*implicit*/ RectangularMatrix(): _data() {} /** * @brief Initializer-list constructor @@ -127,7 +127,7 @@ template class RectangularMatrix { * @todoc Remove workaround when Doxygen supports uniform initialization */ #ifndef DOXYGEN_GENERATING_OUTPUT - template inline constexpr RectangularMatrix(T first, U... next): _data{first, next...} { + template inline constexpr /*implicit*/ RectangularMatrix(T first, U... next): _data{first, next...} { static_assert(sizeof...(next)+1 == cols*rows, "Improper number of arguments passed to RectangularMatrix constructor"); } #else diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 1f315d9fd..99b0bc32b 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -69,7 +69,7 @@ template class Vector: public RectangularMatrix<1, si } /** @brief Default constructor */ - inline constexpr Vector() {} + inline constexpr /*implicit*/ Vector() {} /** @todo Creating Vector from combination of vector and scalar types */ @@ -79,9 +79,9 @@ template class Vector: public RectangularMatrix<1, si * @param next Next values */ #ifndef DOXYGEN_GENERATING_OUTPUT - template inline constexpr Vector(T first, U... next): RectangularMatrix<1, size, T>(first, next...) {} + template inline constexpr /*implicit*/ Vector(T first, U... next): RectangularMatrix<1, size, T>(first, next...) {} #else - template inline constexpr Vector(T first, U... next); + template inline constexpr /*implicit*/ Vector(T first, U... next); #endif /** diff --git a/src/Math/Vector2.h b/src/Math/Vector2.h index 61534e2a8..24297213a 100644 --- a/src/Math/Vector2.h +++ b/src/Math/Vector2.h @@ -72,20 +72,20 @@ template class Vector2: public Vector<2, T> { inline constexpr static Vector2 yScale(T scale) { return Vector2(T(1), scale); } /** @copydoc Vector::Vector() */ - inline constexpr Vector2() {} + inline constexpr /*implicit*/ Vector2() {} /** @copydoc Vector::Vector(T) */ inline constexpr explicit Vector2(T value): Vector<2, T>(value, value) {} - /** @brief Copy constructor */ - inline constexpr Vector2(const RectangularMatrix<1, 2, T>& other): Vector<2, T>(other) {} - /** * @brief Constructor * @param x X component * @param y Y component */ - inline constexpr Vector2(T x, T y): Vector<2, T>(x, y) {} + inline constexpr /*implicit*/ Vector2(T x, T y): Vector<2, T>(x, y) {} + + /** @brief Copy constructor */ + inline constexpr Vector2(const RectangularMatrix<1, 2, T>& other): Vector<2, T>(other) {} inline T& x() { return (*this)[0]; } /**< @brief X component */ inline constexpr T x() const { return (*this)[0]; } /**< @overload */ diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index 88db8214b..52250101b 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -104,28 +104,28 @@ template class Vector3: public Vector<3, T> { } /** @copydoc Vector::Vector() */ - inline constexpr Vector3() {} + inline constexpr /*implicit*/ Vector3() {} /** @copydoc Vector::Vector(T) */ inline constexpr explicit Vector3(T value): Vector<3, T>(value, value, value) {} - /** @brief Copy constructor */ - inline constexpr Vector3(const RectangularMatrix<1, 3, T>& other): Vector<3, T>(other) {} - /** * @brief Constructor * @param x X component * @param y Y component * @param z Z component */ - inline constexpr Vector3(T x, T y, T z): Vector<3, T>(x, y, z) {} + inline constexpr /*implicit*/ Vector3(T x, T y, T z): Vector<3, T>(x, y, z) {} /** * @brief Constructor * @param xy Two-component vector * @param z Z component */ - inline constexpr Vector3(const Vector2& xy, T z): Vector<3, T>(xy[0], xy[1], z) {} + inline constexpr /*implicit*/ Vector3(const Vector2& xy, T z): Vector<3, T>(xy[0], xy[1], z) {} + + /** @brief Copy constructor */ + inline constexpr Vector3(const RectangularMatrix<1, 3, T>& other): Vector<3, T>(other) {} inline T& x() { return (*this)[0]; } /**< @brief X component */ inline constexpr T x() const { return (*this)[0]; } /**< @overload */ diff --git a/src/Math/Vector4.h b/src/Math/Vector4.h index 94a680fac..206b5a8aa 100644 --- a/src/Math/Vector4.h +++ b/src/Math/Vector4.h @@ -35,14 +35,11 @@ homogeneous three-dimensional coordinates. template class Vector4: public Vector<4, T> { public: /** @copydoc Vector::Vector() */ - inline constexpr Vector4() {} + inline constexpr /*implicit*/ Vector4() {} /** @copydoc Vector::Vector(T) */ inline constexpr explicit Vector4(T value): Vector<4, T>(value, value, value, value) {} - /** @brief Copy constructor */ - inline constexpr Vector4(const RectangularMatrix<1, 4, T>& other): Vector<4, T>(other) {} - /** * @brief Constructor * @param x X component @@ -50,14 +47,17 @@ template class Vector4: public Vector<4, T> { * @param z Z component * @param w W component */ - inline constexpr Vector4(T x, T y, T z, T w): Vector<4, T>(x, y, z, w) {} + inline constexpr /*implicit*/ Vector4(T x, T y, T z, T w): Vector<4, T>(x, y, z, w) {} /** * @brief Constructor * @param xyz Three-component vector * @param w W component */ - inline constexpr Vector4(const Vector3& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {} + inline constexpr /*implicit*/ Vector4(const Vector3& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {} + + /** @brief Copy constructor */ + inline constexpr Vector4(const RectangularMatrix<1, 4, T>& other): Vector<4, T>(other) {} inline T& x() { return (*this)[0]; } /**< @brief X component */ inline constexpr T x() const { return (*this)[0]; } /**< @overload */ diff --git a/src/Mesh.h b/src/Mesh.h index f4cf516ad..931e5140b 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -365,7 +365,7 @@ class MAGNUM_EXPORT Mesh { * @see setPrimitive(), setVertexCount(), @fn_gl{GenVertexArrays} (if * @extension{APPLE,vertex_array_object} is available) */ - inline Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0) { + inline explicit Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0) { (this->*createImplementation)(); } diff --git a/src/Physics/AbstractShape.h b/src/Physics/AbstractShape.h index cebb5f61e..84fc07a25 100644 --- a/src/Physics/AbstractShape.h +++ b/src/Physics/AbstractShape.h @@ -93,7 +93,7 @@ template class MAGNUM_PHYSICS_EXPORT AbstractShape { typedef typename Implementation::ShapeDimensionTraits::Type Type; #endif - /** @brief Destructor */ + explicit AbstractShape() = default; virtual inline ~AbstractShape() {} /** @brief Shape type */ diff --git a/src/Physics/AxisAlignedBox.h b/src/Physics/AxisAlignedBox.h index 15f96d1c3..ed642b966 100644 --- a/src/Physics/AxisAlignedBox.h +++ b/src/Physics/AxisAlignedBox.h @@ -34,7 +34,7 @@ namespace Magnum { namespace Physics { template class MAGNUM_PHYSICS_EXPORT AxisAlignedBox: public AbstractShape { public: /** @brief Constructor */ - inline AxisAlignedBox(const typename DimensionTraits::VectorType& position, const typename DimensionTraits::VectorType& size): _position(position), _transformedPosition(position), _size(size), _transformedSize(size) {} + inline explicit AxisAlignedBox(const typename DimensionTraits::VectorType& position, const typename DimensionTraits::VectorType& size): _position(position), _transformedPosition(position), _size(size), _transformedSize(size) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::AxisAlignedBox; diff --git a/src/Physics/Box.h b/src/Physics/Box.h index 272236540..67c0b80a0 100644 --- a/src/Physics/Box.h +++ b/src/Physics/Box.h @@ -36,7 +36,7 @@ namespace Magnum { namespace Physics { template class MAGNUM_PHYSICS_EXPORT Box: public AbstractShape { public: /** @brief Constructor */ - inline Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation), _transformedTransformation(transformation) {} + inline explicit Box(const typename DimensionTraits::MatrixType& transformation): _transformation(transformation), _transformedTransformation(transformation) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::Box; diff --git a/src/Physics/Capsule.h b/src/Physics/Capsule.h index e2ff9da69..9fd8e15d8 100644 --- a/src/Physics/Capsule.h +++ b/src/Physics/Capsule.h @@ -37,7 +37,7 @@ applying transformation, the scale factor is averaged from all axes. template class MAGNUM_PHYSICS_EXPORT Capsule: public AbstractShape { public: /** @brief Constructor */ - inline Capsule(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, float radius): _a(a), _transformedA(a), _b(b), _transformedB(b), _radius(radius), _transformedRadius(radius) {} + inline explicit Capsule(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b, float radius): _a(a), _transformedA(a), _b(b), _transformedB(b), _radius(radius), _transformedRadius(radius) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::Capsule; diff --git a/src/Physics/DebugDrawResourceManager.h b/src/Physics/DebugDrawResourceManager.h index ffabe9350..9381ac3f7 100644 --- a/src/Physics/DebugDrawResourceManager.h +++ b/src/Physics/DebugDrawResourceManager.h @@ -104,7 +104,7 @@ class MAGNUM_PHYSICS_EXPORT DebugDrawResourceManager: public ResourceManager static SceneGraph::Drawable* createDebugRenderer(ObjectShape* shape, ResourceKey options = ResourceKey()); - DebugDrawResourceManager(); + explicit DebugDrawResourceManager(); ~DebugDrawResourceManager(); private: diff --git a/src/Physics/Line.h b/src/Physics/Line.h index 9230be376..79c721d09 100644 --- a/src/Physics/Line.h +++ b/src/Physics/Line.h @@ -35,7 +35,7 @@ namespace Magnum { namespace Physics { template class MAGNUM_PHYSICS_EXPORT Line: public AbstractShape { public: /** @brief Constructor */ - inline Line(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): _a(a), _transformedA(a), _b(b), _transformedB(b) {} + inline explicit Line(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): _a(a), _transformedA(a), _b(b), _transformedB(b) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::Line; diff --git a/src/Physics/LineSegment.h b/src/Physics/LineSegment.h index 4ed4b9449..f36c878f7 100644 --- a/src/Physics/LineSegment.h +++ b/src/Physics/LineSegment.h @@ -31,7 +31,7 @@ namespace Magnum { namespace Physics { template class LineSegment: public Line { public: /** @brief Constructor */ - inline LineSegment(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): Line(a, b) {} + inline explicit LineSegment(const typename DimensionTraits::VectorType& a, const typename DimensionTraits::VectorType& b): Line(a, b) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::LineSegment; diff --git a/src/Physics/ObjectShape.h b/src/Physics/ObjectShape.h index b1d04e1fd..259ee93ef 100644 --- a/src/Physics/ObjectShape.h +++ b/src/Physics/ObjectShape.h @@ -42,7 +42,7 @@ template class MAGNUM_PHYSICS_EXPORT ObjectShape: publi * Creates empty object shape. * @see setShape() */ - ObjectShape(SceneGraph::AbstractObject* object, ObjectShapeGroup* group = nullptr); + explicit ObjectShape(SceneGraph::AbstractObject* object, ObjectShapeGroup* group = nullptr); /** * @brief Destructor diff --git a/src/Physics/ObjectShapeGroup.h b/src/Physics/ObjectShapeGroup.h index 4e2c1a188..6747704e0 100644 --- a/src/Physics/ObjectShapeGroup.h +++ b/src/Physics/ObjectShapeGroup.h @@ -43,7 +43,7 @@ template class MAGNUM_PHYSICS_EXPORT ObjectShapeGroup: * * Marks the group as dirty. */ - inline ObjectShapeGroup(): dirty(true) {} + inline explicit ObjectShapeGroup(): dirty(true) {} /** * @brief Whether the group is dirty diff --git a/src/Physics/Plane.h b/src/Physics/Plane.h index 07cc7ad68..38dca5670 100644 --- a/src/Physics/Plane.h +++ b/src/Physics/Plane.h @@ -31,7 +31,7 @@ namespace Magnum { namespace Physics { class MAGNUM_PHYSICS_EXPORT Plane: public AbstractShape<3> { public: /** @brief Constructor */ - inline Plane(const Vector3& position, const Vector3& normal): _position(position), _transformedPosition(position), _normal(normal), _transformedNormal(normal) {} + inline explicit Plane(const Vector3& position, const Vector3& normal): _position(position), _transformedPosition(position), _normal(normal), _transformedNormal(normal) {} inline Type type() const override { return Type::Plane; } diff --git a/src/Physics/Point.h b/src/Physics/Point.h index 741874ad6..10ebf9583 100644 --- a/src/Physics/Point.h +++ b/src/Physics/Point.h @@ -34,7 +34,7 @@ namespace Magnum { namespace Physics { template class MAGNUM_PHYSICS_EXPORT Point: public AbstractShape { public: /** @brief Constructor */ - inline Point(const typename DimensionTraits::VectorType& position): _position(position), _transformedPosition(position) {} + inline explicit Point(const typename DimensionTraits::VectorType& position): _position(position), _transformedPosition(position) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::Point; diff --git a/src/Physics/ShapeGroup.h b/src/Physics/ShapeGroup.h index 0c89901a7..fde6d895a 100644 --- a/src/Physics/ShapeGroup.h +++ b/src/Physics/ShapeGroup.h @@ -91,7 +91,7 @@ template class MAGNUM_PHYSICS_EXPORT ShapeGroup: public public: /** @brief Default constructor */ - inline ShapeGroup(): operation(Implementation::GroupOperation::AlwaysFalse), a(nullptr), b(nullptr) {} + inline explicit ShapeGroup(): operation(Implementation::GroupOperation::AlwaysFalse), a(nullptr), b(nullptr) {} /** @brief Move constructor */ ShapeGroup(ShapeGroup&& other); diff --git a/src/Physics/Sphere.h b/src/Physics/Sphere.h index 24b4dd074..8d95f2512 100644 --- a/src/Physics/Sphere.h +++ b/src/Physics/Sphere.h @@ -37,7 +37,7 @@ applying transformation, the scale factor is averaged from all axes. template class MAGNUM_PHYSICS_EXPORT Sphere: public AbstractShape { public: /** @brief Constructor */ - inline Sphere(const typename DimensionTraits::VectorType& position, float radius): _position(position), _transformedPosition(position), _radius(radius), _transformedRadius(radius) {} + inline explicit Sphere(const typename DimensionTraits::VectorType& position, float radius): _position(position), _transformedPosition(position), _radius(radius), _transformedRadius(radius) {} inline typename AbstractShape::Type type() const override { return AbstractShape::Type::Sphere; diff --git a/src/Platform/AbstractContextHandler.h b/src/Platform/AbstractContextHandler.h index 81adb561b..fd342ca7c 100644 --- a/src/Platform/AbstractContextHandler.h +++ b/src/Platform/AbstractContextHandler.h @@ -33,6 +33,8 @@ template class AbstractContextHandl */ virtual VisualId getVisualId(Display nativeDisplay) = 0; + explicit AbstractContextHandler() = default; + /** * @brief Destructor * diff --git a/src/Platform/AbstractXApplication.h b/src/Platform/AbstractXApplication.h index 8a91dcd86..4b6d4d836 100644 --- a/src/Platform/AbstractXApplication.h +++ b/src/Platform/AbstractXApplication.h @@ -57,7 +57,7 @@ class AbstractXApplication { * * Creates window with double-buffered OpenGL ES 2 context. */ - AbstractXApplication(AbstractContextHandler* contextHandler, int& argc, char** argv, const std::string& title = "Magnum X application", const Vector2i& size = Vector2i(800, 600)); + explicit AbstractXApplication(AbstractContextHandler* contextHandler, int& argc, char** argv, const std::string& title = "Magnum X application", const Vector2i& size = Vector2i(800, 600)); /** * @brief Destructor diff --git a/src/Platform/EglContextHandler.h b/src/Platform/EglContextHandler.h index 878e5d3ab..26d12ba1a 100644 --- a/src/Platform/EglContextHandler.h +++ b/src/Platform/EglContextHandler.h @@ -51,6 +51,7 @@ Used in XEglApplication. */ class EglContextHandler: public AbstractContextHandler { public: + explicit EglContextHandler() = default; ~EglContextHandler(); VisualId getVisualId(EGLNativeDisplayType nativeDisplay) override; diff --git a/src/Platform/GlutApplication.h b/src/Platform/GlutApplication.h index d2fcca1af..6b7fafee0 100644 --- a/src/Platform/GlutApplication.h +++ b/src/Platform/GlutApplication.h @@ -60,7 +60,7 @@ class GlutApplication { * @param title Window title * @param size Window size */ - GlutApplication(int& argc, char** argv, const std::string& title = "Magnum GLUT application", const Vector2i& size = Vector2i(800, 600)); + explicit GlutApplication(int& argc, char** argv, const std::string& title = "Magnum GLUT application", const Vector2i& size = Vector2i(800, 600)); virtual ~GlutApplication(); diff --git a/src/Platform/GlxApplication.h b/src/Platform/GlxApplication.h index 603ea41ae..919fc7dea 100644 --- a/src/Platform/GlxApplication.h +++ b/src/Platform/GlxApplication.h @@ -51,7 +51,7 @@ class GlxApplication: public AbstractXApplication { * @param title Window title * @param size Window size */ - inline GlxApplication(int& argc, char** argv, const std::string& title = "Magnum GLX application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new GlxContextHandler, argc, argv, title, size) {} + inline explicit GlxApplication(int& argc, char** argv, const std::string& title = "Magnum GLX application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new GlxContextHandler, argc, argv, title, size) {} }; }} diff --git a/src/Platform/GlxContextHandler.h b/src/Platform/GlxContextHandler.h index 136241466..1a8f7b85f 100644 --- a/src/Platform/GlxContextHandler.h +++ b/src/Platform/GlxContextHandler.h @@ -39,6 +39,7 @@ GlxApplication. */ class GlxContextHandler: public AbstractContextHandler { public: + explicit GlxContextHandler() = default; ~GlxContextHandler(); VisualID getVisualId(Display* nativeDisplay) override; diff --git a/src/Platform/Sdl2Application.h b/src/Platform/Sdl2Application.h index ac1265881..82f2b377e 100644 --- a/src/Platform/Sdl2Application.h +++ b/src/Platform/Sdl2Application.h @@ -65,7 +65,7 @@ class Sdl2Application { * @param title Window title * @param size Window size */ - Sdl2Application(int argc, char** argv, const std::string& title = "Magnum SDL2 application", const Vector2i& size = Vector2i(800, 600)); + explicit Sdl2Application(int argc, char** argv, const std::string& title = "Magnum SDL2 application", const Vector2i& size = Vector2i(800, 600)); /** * @brief Destructor diff --git a/src/Platform/WindowlessGlxApplication.h b/src/Platform/WindowlessGlxApplication.h index 9557d4718..e3e2d2e39 100644 --- a/src/Platform/WindowlessGlxApplication.h +++ b/src/Platform/WindowlessGlxApplication.h @@ -55,7 +55,7 @@ class WindowlessGlxApplication { * Creates window with double-buffered OpenGL 3.2 core context or * OpenGL ES 2.0 context, if targetting OpenGL ES. */ - WindowlessGlxApplication(int& argc, char** argv); + explicit WindowlessGlxApplication(int& argc, char** argv); ~WindowlessGlxApplication(); diff --git a/src/Platform/XEglApplication.h b/src/Platform/XEglApplication.h index 6ded61519..fab076393 100644 --- a/src/Platform/XEglApplication.h +++ b/src/Platform/XEglApplication.h @@ -51,7 +51,7 @@ class XEglApplication: public AbstractXApplication { * @param title Window title * @param size Window size */ - inline XEglApplication(int& argc, char** argv, const std::string& title = "Magnum X/EGL application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new EglContextHandler, argc, argv, title, size) {} + inline explicit XEglApplication(int& argc, char** argv, const std::string& title = "Magnum X/EGL application", const Vector2i& size = Vector2i(800, 600)): AbstractXApplication(new EglContextHandler, argc, argv, title, size) {} }; }} diff --git a/src/Primitives/Capsule.h b/src/Primitives/Capsule.h index 1d9e118a6..94650a039 100644 --- a/src/Primitives/Capsule.h +++ b/src/Primitives/Capsule.h @@ -53,7 +53,7 @@ class Capsule: public Trade::MeshData3D { * If texture coordinates are generated, vertices of one segment are * duplicated for texture wrapping. */ - Capsule(std::uint32_t hemisphereRings, std::uint32_t cylinderRings, std::uint32_t segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate); + explicit Capsule(std::uint32_t hemisphereRings, std::uint32_t cylinderRings, std::uint32_t segments, GLfloat length, TextureCoords textureCoords = TextureCoords::DontGenerate); private: Capsule(std::uint32_t segments, TextureCoords textureCoords); diff --git a/src/Primitives/Cube.h b/src/Primitives/Cube.h index fd329c4a8..b62606c16 100644 --- a/src/Primitives/Cube.h +++ b/src/Primitives/Cube.h @@ -31,7 +31,7 @@ namespace Magnum { namespace Primitives { class Cube: public Trade::MeshData3D { public: /** @brief Constructor */ - Cube(); + explicit Cube(); }; }} diff --git a/src/Primitives/Cylinder.h b/src/Primitives/Cylinder.h index 29da7a73b..542d3c8c5 100644 --- a/src/Primitives/Cylinder.h +++ b/src/Primitives/Cylinder.h @@ -58,7 +58,7 @@ class Cylinder: public Capsule { * If texture coordinates are generated, vertices of one segment are * duplicated for texture wrapping. */ - Cylinder(std::uint32_t rings, std::uint32_t segments, GLfloat length, Flags flags = Flags()); + explicit Cylinder(std::uint32_t rings, std::uint32_t segments, GLfloat length, Flags flags = Flags()); private: void capVertexRing(GLfloat y, GLfloat textureCoordsV, const Vector3& normal); diff --git a/src/Primitives/Icosphere.h b/src/Primitives/Icosphere.h index 3f938ba84..9e1b275ba 100644 --- a/src/Primitives/Icosphere.h +++ b/src/Primitives/Icosphere.h @@ -38,7 +38,7 @@ from Blender. template<> class Icosphere<0>: public Trade::MeshData3D { public: /** @brief Constructor */ - Icosphere(); + explicit Icosphere(); }; /** @@ -54,7 +54,7 @@ template class Icosphere { #endif public: /** @brief Constructor */ - Icosphere() { + explicit Icosphere() { for(std::size_t i = 0; i != subdivisions; ++i) MeshTools::subdivide(*indices(), *normals(0), [](const Vector3& a, const Vector3& b) { return (a+b).normalized(); diff --git a/src/Primitives/Plane.h b/src/Primitives/Plane.h index 1cdb6f104..9de4f9a2b 100644 --- a/src/Primitives/Plane.h +++ b/src/Primitives/Plane.h @@ -31,7 +31,7 @@ namespace Magnum { namespace Primitives { class Plane: public Trade::MeshData3D { public: /** @brief Constructor */ - Plane(); + explicit Plane(); }; }} diff --git a/src/Primitives/Square.h b/src/Primitives/Square.h index d83520580..7d3f96754 100644 --- a/src/Primitives/Square.h +++ b/src/Primitives/Square.h @@ -31,7 +31,7 @@ namespace Magnum { namespace Primitives { class Square: public Trade::MeshData2D { public: /** @brief Constructor */ - Square(); + explicit Square(); }; }} diff --git a/src/Primitives/UVSphere.h b/src/Primitives/UVSphere.h index 8d2f01054..5a55cda1d 100644 --- a/src/Primitives/UVSphere.h +++ b/src/Primitives/UVSphere.h @@ -39,7 +39,7 @@ class UVSphere: public Capsule { * If texture coordinates are generated, vertices of one segment are * duplicated for texture wrapping. */ - UVSphere(std::uint32_t rings, std::uint32_t segments, TextureCoords textureCoords = TextureCoords::DontGenerate); + explicit UVSphere(std::uint32_t rings, std::uint32_t segments, TextureCoords textureCoords = TextureCoords::DontGenerate); }; }} diff --git a/src/Profiler.h b/src/Profiler.h index db2e94f0c..173b00b17 100644 --- a/src/Profiler.h +++ b/src/Profiler.h @@ -105,7 +105,7 @@ class MAGNUM_EXPORT Profiler { static const Section otherSection = 0; #ifndef DOXYGEN_GENERATING_OUTPUT - Profiler(): enabled(false), measureDuration(60), currentFrame(0), frameCount(0), sections{"Other"}, currentSection(otherSection) {} + explicit Profiler(): enabled(false), measureDuration(60), currentFrame(0), frameCount(0), sections{"Other"}, currentSection(otherSection) {} #endif /** diff --git a/src/Query.h b/src/Query.h index d548e2100..ff3f9ca22 100644 --- a/src/Query.h +++ b/src/Query.h @@ -40,7 +40,7 @@ class MAGNUM_EXPORT AbstractQuery { * Generates one OpenGL query. * @see @fn_gl{GenQueries} */ - inline AbstractQuery() { + inline explicit AbstractQuery() { /** @todo Get some extension wrangler instead to avoid undeclared glGenQueries() on ES2 */ #ifndef MAGNUM_TARGET_GLES2 glGenQueries(1, &_id); @@ -153,7 +153,7 @@ class MAGNUM_EXPORT Query: public AbstractQuery { #endif }; - inline Query(): target(nullptr) {} + inline explicit Query(): target(nullptr) {} inline ~Query() { delete target; } @@ -284,7 +284,7 @@ class MAGNUM_EXPORT SampleQuery: public AbstractQuery { }; #endif - inline SampleQuery(): target(nullptr) {} + inline explicit SampleQuery(): target(nullptr) {} inline ~SampleQuery() { delete target; } @@ -358,6 +358,8 @@ Using this query results in fewer OpenGL calls when doing more measures. */ class TimeQuery: public AbstractQuery { public: + explicit TimeQuery() = default; + /** * @brief Query timestamp * diff --git a/src/Renderbuffer.h b/src/Renderbuffer.h index 0d687fe48..7016db189 100644 --- a/src/Renderbuffer.h +++ b/src/Renderbuffer.h @@ -512,7 +512,7 @@ class Renderbuffer { * Generates new OpenGL renderbuffer. * @see @fn_gl{GenRenderbuffers} */ - inline Renderbuffer() { + inline explicit Renderbuffer() { glGenRenderbuffers(1, &renderbuffer); } diff --git a/src/Resource.h b/src/Resource.h index 4084aebfb..7b94a491e 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -120,7 +120,7 @@ class Resource { * Creates empty resource. Resources are acquired from the manager by * calling ResourceManager::get(). */ - inline Resource(): manager(nullptr), lastCheck(0), _state(ResourceState::Final), data(nullptr) {} + inline explicit Resource(): manager(nullptr), lastCheck(0), _state(ResourceState::Final), data(nullptr) {} /** @brief Copy constructor */ inline Resource(const Resource& other): manager(other.manager), _key(other._key), lastCheck(other.lastCheck), _state(other._state), data(other.data) { diff --git a/src/SceneGraph/AbstractCamera.h b/src/SceneGraph/AbstractCamera.h index b66369436..9b24759fb 100644 --- a/src/SceneGraph/AbstractCamera.h +++ b/src/SceneGraph/AbstractCamera.h @@ -75,7 +75,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera: public AbstractFeature* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { + inline explicit AbstractCamera(AbstractObject* object): AbstractFeature(object), _aspectRatioPolicy(AspectRatioPolicy::NotPreserved) { AbstractFeature::setCachedTransformations(AbstractFeature::CachedTransformation::InvertedAbsolute); } diff --git a/src/SceneGraph/AbstractFeature.h b/src/SceneGraph/AbstractFeature.h index 4506c2d4f..4d48312f2 100644 --- a/src/SceneGraph/AbstractFeature.h +++ b/src/SceneGraph/AbstractFeature.h @@ -132,7 +132,7 @@ template class AbstractFeature * @brief Constructor * @param object %Object holding this feature */ - inline AbstractFeature(AbstractObject* object) { + inline explicit AbstractFeature(AbstractObject* object) { object->Corrade::Containers::LinkedList>::insert(this); } diff --git a/src/SceneGraph/AbstractGroupedFeature.h b/src/SceneGraph/AbstractGroupedFeature.h index 9e6aaf5f2..5998895c7 100644 --- a/src/SceneGraph/AbstractGroupedFeature.h +++ b/src/SceneGraph/AbstractGroupedFeature.h @@ -64,7 +64,7 @@ class AbstractGroupedFeature: public AbstractFeature { * Adds the feature to the object and to group, if specified. * @see FeatureGroup::add() */ - inline AbstractGroupedFeature(AbstractObject* object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { + inline explicit AbstractGroupedFeature(AbstractObject* object, FeatureGroup* group = nullptr): AbstractFeature(object), _group(nullptr) { if(group) group->add(static_cast(this)); } diff --git a/src/SceneGraph/AbstractObject.h b/src/SceneGraph/AbstractObject.h index 08f9a4ac5..64ef2aeff 100644 --- a/src/SceneGraph/AbstractObject.h +++ b/src/SceneGraph/AbstractObject.h @@ -59,6 +59,7 @@ template class AbstractObject /** @brief Feature object type */ typedef AbstractFeature FeatureType; + explicit AbstractObject() = default; inline virtual ~AbstractObject() {} /** @brief Whether this object has features */ diff --git a/src/SceneGraph/AbstractTransformation.h b/src/SceneGraph/AbstractTransformation.h index d3fc55f99..4fed38811 100644 --- a/src/SceneGraph/AbstractTransformation.h +++ b/src/SceneGraph/AbstractTransformation.h @@ -54,6 +54,7 @@ class AbstractTransformation { /** @brief Dimension count */ static const std::uint8_t Dimensions = dimensions; + explicit AbstractTransformation() = default; virtual ~AbstractTransformation() = 0; #ifdef DOXYGEN_GENERATING_OUTPUT diff --git a/src/SceneGraph/AbstractTranslationRotation2D.h b/src/SceneGraph/AbstractTranslationRotation2D.h index 62be8ef0e..215be0d49 100644 --- a/src/SceneGraph/AbstractTranslationRotation2D.h +++ b/src/SceneGraph/AbstractTranslationRotation2D.h @@ -35,6 +35,8 @@ template #endif class AbstractTranslationRotation2D: public AbstractTransformation<2, T> { public: + explicit AbstractTranslationRotation2D() = default; + /** * @brief Translate object * @param vector Translation vector diff --git a/src/SceneGraph/AbstractTranslationRotation3D.h b/src/SceneGraph/AbstractTranslationRotation3D.h index 1bd1ff6b3..bfc63943d 100644 --- a/src/SceneGraph/AbstractTranslationRotation3D.h +++ b/src/SceneGraph/AbstractTranslationRotation3D.h @@ -36,6 +36,8 @@ template #endif class AbstractTranslationRotation3D: public AbstractTransformation<3, T> { public: + explicit AbstractTranslationRotation3D() = default; + /** * @brief Translate object * @param vector Translation vector diff --git a/src/SceneGraph/AbstractTranslationRotationScaling2D.h b/src/SceneGraph/AbstractTranslationRotationScaling2D.h index 269aada69..45476a17d 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling2D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling2D.h @@ -35,6 +35,8 @@ template #endif class AbstractTranslationRotationScaling2D: public AbstractTranslationRotation2D { public: + explicit AbstractTranslationRotationScaling2D() = default; + /** * @brief Scale object * @param vector Scaling vector diff --git a/src/SceneGraph/AbstractTranslationRotationScaling3D.h b/src/SceneGraph/AbstractTranslationRotationScaling3D.h index 30cebf0ad..a2a1fb3de 100644 --- a/src/SceneGraph/AbstractTranslationRotationScaling3D.h +++ b/src/SceneGraph/AbstractTranslationRotationScaling3D.h @@ -35,6 +35,8 @@ template #endif class AbstractTranslationRotationScaling3D: public AbstractTranslationRotation3D { public: + explicit AbstractTranslationRotationScaling3D() = default; + /** * @brief Scale object * @param vector Scaling vector diff --git a/src/SceneGraph/Animable.h b/src/SceneGraph/Animable.h index 9bb2b3ac8..48a7915fc 100644 --- a/src/SceneGraph/Animable.h +++ b/src/SceneGraph/Animable.h @@ -148,7 +148,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Animable: public AbstractGroupedFeature* object, GLfloat duration, AnimableGroup* group = nullptr); + explicit Animable(AbstractObject* object, GLfloat duration, AnimableGroup* group = nullptr); /** @brief Animation duration */ inline GLfloat duration() const { return _duration; } diff --git a/src/SceneGraph/AnimableGroup.h b/src/SceneGraph/AnimableGroup.h index 243dfb5a7..6c86b3b6f 100644 --- a/src/SceneGraph/AnimableGroup.h +++ b/src/SceneGraph/AnimableGroup.h @@ -43,7 +43,7 @@ class MAGNUM_SCENEGRAPH_EXPORT AnimableGroup: public FeatureGroup { * Sets orthographic projection to the default OpenGL cube (range @f$ [-1; 1] @f$ in all directions). * @see setOrthographic() */ - inline Camera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} + inline explicit Camera2D(AbstractObject<2, T>* object): AbstractCamera<2, T>(object) {} /** * @brief Set projection diff --git a/src/SceneGraph/Camera3D.h b/src/SceneGraph/Camera3D.h index 688a5ce9b..ea0aca366 100644 --- a/src/SceneGraph/Camera3D.h +++ b/src/SceneGraph/Camera3D.h @@ -65,7 +65,7 @@ class MAGNUM_SCENEGRAPH_EXPORT Camera3D: public AbstractCamera<3, T> { * (range @f$ [-1; 1] @f$ in all directions). * @see setOrthographic(), setPerspective() */ - inline Camera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(0.0f), _far(0.0f) {} + inline explicit Camera3D(AbstractObject<3, T>* object): AbstractCamera<3, T>(object), _near(0.0f), _far(0.0f) {} /** * @brief Set orthographic projection diff --git a/src/SceneGraph/Drawable.h b/src/SceneGraph/Drawable.h index 99148d2f2..36ee9fa75 100644 --- a/src/SceneGraph/Drawable.h +++ b/src/SceneGraph/Drawable.h @@ -115,7 +115,7 @@ template class Drawable: public AbstractGroupedFeature, T> { public: /** @copydoc AbstractGroupedFeature::AbstractGroupedFeature() */ - inline Drawable(AbstractObject* object, DrawableGroup* group = nullptr): AbstractGroupedFeature, T>(object, group) {} + inline explicit Drawable(AbstractObject* object, DrawableGroup* group = nullptr): AbstractGroupedFeature, T>(object, group) {} /** * @brief Draw the object using given camera diff --git a/src/SceneGraph/FeatureGroup.h b/src/SceneGraph/FeatureGroup.h index 293942eb6..3aecc66d1 100644 --- a/src/SceneGraph/FeatureGroup.h +++ b/src/SceneGraph/FeatureGroup.h @@ -42,6 +42,8 @@ class FeatureGroup { friend class AbstractGroupedFeature; public: + explicit FeatureGroup() = default; + /** * @brief Destructor * diff --git a/src/SceneGraph/MatrixTransformation2D.h b/src/SceneGraph/MatrixTransformation2D.h index ceeab86fc..e797fba84 100644 --- a/src/SceneGraph/MatrixTransformation2D.h +++ b/src/SceneGraph/MatrixTransformation2D.h @@ -131,7 +131,7 @@ class MatrixTransformation2D: public AbstractTranslationRotationScaling2D { protected: /* Allow construction only from Object */ - inline MatrixTransformation2D() {} + inline explicit MatrixTransformation2D() = default; private: Math::Matrix3 _transformation; diff --git a/src/SceneGraph/MatrixTransformation3D.h b/src/SceneGraph/MatrixTransformation3D.h index 7eabf1938..4afc360c0 100644 --- a/src/SceneGraph/MatrixTransformation3D.h +++ b/src/SceneGraph/MatrixTransformation3D.h @@ -162,7 +162,7 @@ class MatrixTransformation3D: public AbstractTranslationRotationScaling3D { protected: /* Allow construction only from Object */ - inline MatrixTransformation3D() {} + inline explicit MatrixTransformation3D() = default; private: Math::Matrix4 _transformation; diff --git a/src/SceneGraph/Object.h b/src/SceneGraph/Object.h index 5c87c5a47..b6f06696d 100644 --- a/src/SceneGraph/Object.h +++ b/src/SceneGraph/Object.h @@ -105,7 +105,7 @@ template class Object: public AbstractObject* parent = nullptr): counter(0xFFFFu), flags(Flag::Dirty) { + inline explicit Object(Object* parent = nullptr): counter(0xFFFFu), flags(Flag::Dirty) { setParent(parent); } diff --git a/src/SceneGraph/Scene.h b/src/SceneGraph/Scene.h index eecc231f0..9f06d3f8a 100644 --- a/src/SceneGraph/Scene.h +++ b/src/SceneGraph/Scene.h @@ -31,6 +31,8 @@ See @ref scenegraph for introduction. */ template class Scene: public Object { public: + explicit Scene() = default; + inline bool isScene() const { return true; } }; diff --git a/src/Shader.h b/src/Shader.h index 798a6c223..3fb8d6c3d 100644 --- a/src/Shader.h +++ b/src/Shader.h @@ -135,7 +135,7 @@ class MAGNUM_EXPORT Shader { * beginning. Sources can be added with addSource() or addFile(). * @see fromData(), fromFile(), @fn_gl{CreateShader} */ - Shader(Version version, Type type); + explicit Shader(Version version, Type type); /** * @brief Destructor diff --git a/src/Shaders/FlatShader.h b/src/Shaders/FlatShader.h index dc83f8d60..33ee62607 100644 --- a/src/Shaders/FlatShader.h +++ b/src/Shaders/FlatShader.h @@ -40,7 +40,7 @@ template class MAGNUM_SHADERS_EXPORT FlatShader: public /** @brief Vertex position */ typedef Attribute<0, typename DimensionTraits::PointType> Position; - FlatShader(); + explicit FlatShader(); /** * @brief Set transformation and projection matrix diff --git a/src/Shaders/PhongShader.h b/src/Shaders/PhongShader.h index cbfc4eba6..ff0d483cf 100644 --- a/src/Shaders/PhongShader.h +++ b/src/Shaders/PhongShader.h @@ -38,7 +38,7 @@ class MAGNUM_SHADERS_EXPORT PhongShader: public AbstractShaderProgram { typedef Attribute<0, Point3D> Position; /**< @brief Vertex position */ typedef Attribute<1, Vector3> Normal; /**< @brief Normal direction */ - PhongShader(); + explicit PhongShader(); /** * @brief Set ambient color diff --git a/src/Shaders/VertexColorShader.h b/src/Shaders/VertexColorShader.h index c529521ff..061022a91 100644 --- a/src/Shaders/VertexColorShader.h +++ b/src/Shaders/VertexColorShader.h @@ -43,7 +43,7 @@ template class MAGNUM_SHADERS_EXPORT VertexColorShader: /** @brief Vertex color */ typedef Attribute<1, Color3<>> Color; - VertexColorShader(); + explicit VertexColorShader(); /** * @brief Set transformation and projection matrix diff --git a/src/SizeTraits.h b/src/SizeTraits.h index d221fcada..f007d5e4c 100644 --- a/src/SizeTraits.h +++ b/src/SizeTraits.h @@ -113,7 +113,7 @@ template struct SizeBasedCall: public Base { * @brief Constructor * @param size Data size */ - SizeBasedCall(std::size_t size): size(size) {} + explicit SizeBasedCall(std::size_t size): size(size) {} /** * @brief Functor diff --git a/src/Texture.h b/src/Texture.h index cc7ec7ff5..c3da55f57 100644 --- a/src/Texture.h +++ b/src/Texture.h @@ -169,7 +169,7 @@ template class Texture: public AbstractTexture { * * Creates one OpenGL texture. */ - inline Texture(Target target = DataHelper::target()): AbstractTexture(static_cast(target)) {} + inline explicit Texture(Target target = DataHelper::target()): AbstractTexture(static_cast(target)) {} /** @brief %Texture target */ inline constexpr Target target() const { return static_cast(_target); } diff --git a/src/Timeline.h b/src/Timeline.h index 42c22249e..581f2ba2b 100644 --- a/src/Timeline.h +++ b/src/Timeline.h @@ -78,7 +78,7 @@ class MAGNUM_EXPORT Timeline { * Creates stopped timeline. * @see start() */ - inline constexpr Timeline(): _minimalFrameTime(0), _previousFrameDuration(0), running(false) {} + inline constexpr explicit Timeline(): _minimalFrameTime(0), _previousFrameDuration(0), running(false) {} /** @brief Minimal frame time (in seconds) */ inline constexpr GLfloat minimalFrameTime() const { diff --git a/src/Trade/AbstractImporter.h b/src/Trade/AbstractImporter.h index 23cef208c..2d2557661 100644 --- a/src/Trade/AbstractImporter.h +++ b/src/Trade/AbstractImporter.h @@ -75,7 +75,7 @@ class MAGNUM_EXPORT AbstractImporter: public Corrade::PluginManager::Plugin { typedef Corrade::Containers::EnumSet Features; /** @brief Constructor */ - inline AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {} + inline explicit AbstractImporter(Corrade::PluginManager::AbstractPluginManager* manager = nullptr, const std::string& plugin = ""): Plugin(manager, plugin) {} /** @brief Features supported by this importer */ virtual Features features() const = 0;