View Single Post
Old 16th December 2016, 14:58   #24  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
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;

Last edited by feisty2; 16th December 2016 at 15:00.
feisty2 is offline   Reply With Quote