Skip to content

Commit 91317a4

Browse files
committed
Forward declare explicit template specializations
1 parent 75a0d1b commit 91317a4

1 file changed

Lines changed: 27 additions & 18 deletions

File tree

al/eax/effect.h

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ struct EaxCommitter {
124124
EffectProps &mAlProps;
125125

126126
template<typename TValidator, typename TProperty>
127-
static void defer(const EaxCall &call, TProperty &property)
127+
static auto defer(const EaxCall &call, TProperty &property) -> void
128128
{
129129
const auto &value = call.load<const TProperty>();
130130
TValidator{}(value);
131131
property = value;
132132
}
133133

134-
[[noreturn]] static void fail(std::string_view message);
135-
[[noreturn]] static void fail_unknown_property_id()
134+
[[noreturn]] static auto fail(std::string_view message) -> void;
135+
[[noreturn]] static auto fail_unknown_property_id() -> void
136136
{ fail(EaxEffectErrorMessages::unknown_property_id()); }
137137

138138
EaxCommitter(EaxEffectProps &eaxprops, EffectProps &alprops)
@@ -141,23 +141,32 @@ struct EaxCommitter {
141141

142142
[[nodiscard]] auto commit(const P &props) const -> bool;
143143

144-
static void SetDefaults(EaxEffectProps &props);
145-
static void Get(const EaxCall &call, const P &props);
146-
static void Set(const EaxCall &call, P &props);
144+
static auto SetDefaults(EaxEffectProps &props) -> void;
145+
static auto Get(const EaxCall &call, const P &props) -> void;
146+
static auto Set(const EaxCall &call, P &props) -> void;
147147
};
148148

149-
using EaxAutowahCommitter = EaxCommitter<EAXAUTOWAHPROPERTIES>;
150-
using EaxChorusCommitter = EaxCommitter<EAXCHORUSPROPERTIES>;
151-
using EaxCompressorCommitter = EaxCommitter<EAXAGCCOMPRESSORPROPERTIES>;
152-
using EaxDistortionCommitter = EaxCommitter<EAXDISTORTIONPROPERTIES>;
153-
using EaxEchoCommitter = EaxCommitter<EAXECHOPROPERTIES>;
154-
using EaxEqualizerCommitter = EaxCommitter<EAXEQUALIZERPROPERTIES>;
155-
using EaxFlangerCommitter = EaxCommitter<EAXFLANGERPROPERTIES>;
156-
using EaxFrequencyShifterCommitter = EaxCommitter<EAXFREQUENCYSHIFTERPROPERTIES>;
157-
using EaxModulatorCommitter = EaxCommitter<EAXRINGMODULATORPROPERTIES>;
158-
using EaxPitchShifterCommitter = EaxCommitter<EAXPITCHSHIFTERPROPERTIES>;
159-
using EaxVocalMorpherCommitter = EaxCommitter<EAXVOCALMORPHERPROPERTIES>;
160-
using EaxNullCommitter = EaxCommitter<std::monostate>;
149+
#define DECL_COMMITTER(T, P) \
150+
template<> [[noreturn]] auto EaxCommitter<P>::fail(std::string_view message) -> void; \
151+
template<> [[nodiscard]] auto EaxCommitter<P>::commit(P const &props) const -> bool; \
152+
template<> auto EaxCommitter<P>::SetDefaults(EaxEffectProps &props) -> void; \
153+
template<> auto EaxCommitter<P>::Get(const EaxCall &call, P const &props) -> void; \
154+
template<> auto EaxCommitter<P>::Set(const EaxCall &call, P &props) -> void; \
155+
using T = EaxCommitter<P>;
156+
157+
DECL_COMMITTER(EaxAutowahCommitter, EAXAUTOWAHPROPERTIES)
158+
DECL_COMMITTER(EaxChorusCommitter, EAXCHORUSPROPERTIES)
159+
DECL_COMMITTER(EaxCompressorCommitter, EAXAGCCOMPRESSORPROPERTIES)
160+
DECL_COMMITTER(EaxDistortionCommitter, EAXDISTORTIONPROPERTIES)
161+
DECL_COMMITTER(EaxEchoCommitter, EAXECHOPROPERTIES)
162+
DECL_COMMITTER(EaxEqualizerCommitter, EAXEQUALIZERPROPERTIES)
163+
DECL_COMMITTER(EaxFlangerCommitter, EAXFLANGERPROPERTIES)
164+
DECL_COMMITTER(EaxFrequencyShifterCommitter, EAXFREQUENCYSHIFTERPROPERTIES)
165+
DECL_COMMITTER(EaxModulatorCommitter, EAXRINGMODULATORPROPERTIES)
166+
DECL_COMMITTER(EaxPitchShifterCommitter, EAXPITCHSHIFTERPROPERTIES)
167+
DECL_COMMITTER(EaxVocalMorpherCommitter, EAXVOCALMORPHERPROPERTIES)
168+
DECL_COMMITTER(EaxNullCommitter, std::monostate)
169+
#undef DECL_COMMITTER
161170

162171
template<typename> struct CommitterFromProps { };
163172
template<> struct CommitterFromProps<std::monostate> { using type = EaxNullCommitter; };

0 commit comments

Comments
 (0)