or a bit more organized with C++ 14..
Code:
#include <cstdint>
auto operator""ElementsLUTTable(size_t length) {
struct LUTTable final {
int32_t *RGBToLab = nullptr;
int32_t *LabToRGB = nullptr;
LUTTable(size_t length = 0) {
RGBToLab = new int32_t[length];
LabToRGB = new int32_t[length];
}
LUTTable(const LUTTable &) = delete;
LUTTable(LUTTable &&obj) {
RGBToLab = obj.RGBToLab;
LabToRGB = obj.LabToRGB;
obj.RGBToLab = nullptr;
obj.LabToRGB = nullptr;
}
auto &operator=(const LUTTable &) = delete;
auto &operator=(LUTTable &&obj) {
if (this != &obj) {
RGBToLab = obj.RGBToLab;
LabToRGB = obj.LabToRGB;
obj.RGBToLab = nullptr;
obj.LabToRGB = nullptr;
}
return *this;
}
~LUTTable() {
delete[] RGBToLab;
delete[] LabToRGB;
}
};
return LUTTable(length);
}
auto table = 16777216ElementsLUTTable;