From 991c0aece13c93617f65300627aa672be50f4dd7 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 8 Nov 2017 20:18:56 -0800 Subject: [PATCH] Make AttributesEnd a function to work around a C++11 deficiency --- examples/alure-hrtf.cpp | 4 ++-- include/AL/alure2.h | 3 ++- src/device.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/alure-hrtf.cpp b/examples/alure-hrtf.cpp index c9b0153..5191522 100644 --- a/examples/alure-hrtf.cpp +++ b/examples/alure-hrtf.cpp @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) else attrs.push_back({ALC_HRTF_ID_SOFT, std::distance(hrtf_names.begin(), iter)}); } - attrs.push_back(alure::AttributesEnd); + attrs.push_back(alure::AttributesEnd()); alure::Context ctx = dev.createContext(attrs); alure::Context::MakeCurrent(ctx); @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) alure::Array attrs{{ {ALC_HRTF_SOFT, ALC_TRUE}, {ALC_HRTF_ID_SOFT, std::distance(hrtf_names.begin(), iter)}, - alure::AttributesEnd + alure::AttributesEnd() }}; dev.reset(attrs); std::cout<< "Using HRTF \""<; static_assert(sizeof(AttributePair) == sizeof(ALCint[2]), "Bad AttributePair size"); -constexpr AttributePair AttributesEnd{0, 0}; +constexpr inline AttributePair AttributesEnd() noexcept +{ return std::make_pair(0, 0); } struct FilterParams { diff --git a/src/device.cpp b/src/device.cpp index 407e42d..ccf4176 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -202,7 +202,7 @@ void DeviceImpl::reset(ArrayView attributes) Vector attrs; attrs.reserve(attributes.size() + 1); std::copy(attributes.begin(), attributes.end(), std::back_inserter(attrs)); - attrs.push_back(AttributesEnd); + attrs.push_back(AttributesEnd()); return alcResetDeviceSOFT(mDevice, &std::get<0>(attrs.front())); } return alcResetDeviceSOFT(mDevice, &std::get<0>(attributes.front())); @@ -233,7 +233,7 @@ Context DeviceImpl::createContext(ArrayView attributes, bool doth Vector attrs; attrs.reserve(attributes.size() + 1); std::copy(attributes.begin(), attributes.end(), std::back_inserter(attrs)); - attrs.push_back(AttributesEnd); + attrs.push_back(AttributesEnd()); return alcCreateContext(mDevice, &std::get<0>(attrs.front())); } return alcCreateContext(mDevice, &std::get<0>(attributes.front())); -- 2.11.4.GIT