1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-09 22:40:06 +00:00

Added use of C++11 defaulted and deleted constructors

This commit is contained in:
walbourn_cp 2015-02-20 14:43:07 -08:00
parent e23c8e19fd
commit e529c6a73b
2 changed files with 15 additions and 4 deletions

View File

@ -71,7 +71,7 @@ class LDRColorA
public:
uint8_t r, g, b, a;
LDRColorA() {}
LDRColorA() DIRECTX_CTOR_DEFAULT
LDRColorA(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {}
const uint8_t& operator [] (_In_range_(0,3) size_t uElement) const
@ -143,7 +143,7 @@ public:
float r, g, b, a;
public:
HDRColorA() {}
HDRColorA() DIRECTX_CTOR_DEFAULT
HDRColorA(float _r, float _g, float _b, float _a) : r(_r), g(_g), b(_b), a(_a) {}
HDRColorA(const HDRColorA& c) : r(c.r), g(c.g), b(c.b), a(c.a) {}
HDRColorA(const LDRColorA& c)
@ -307,7 +307,7 @@ public:
int pad;
public:
INTColor() {}
INTColor() DIRECTX_CTOR_DEFAULT
INTColor(int nr, int ng, int nb) {r = nr; g = ng; b = nb;}
INTColor(const INTColor& c) {r = c.r; g = c.g; b = c.b;}

View File

@ -46,6 +46,17 @@
#endif
#endif
// VS 2010/2012 do not support =default =delete
#ifndef DIRECTX_CTOR_DEFAULT
#if defined(_MSC_VER) && (_MSC_VER < 1800)
#define DIRECTX_CTOR_DEFAULT {}
#define DIRECTX_CTOR_DELETE ;
#else
#define DIRECTX_CTOR_DEFAULT =default;
#define DIRECTX_CTOR_DELETE =delete;
#endif
#endif
#define DIRECTX_TEX_VERSION 131
namespace DirectX
@ -577,7 +588,7 @@ namespace DirectX
size_t w;
size_t h;
Rect() {}
Rect() DIRECTX_CTOR_DEFAULT
Rect( size_t _x, size_t _y, size_t _w, size_t _h ) : x(_x), y(_y), w(_w), h(_h) {}
};