From 2bc4ab395850efa84ba879c7a9bcff5df6768a39 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 1 Aug 2018 23:55:59 -0400 Subject: sink_details: Deduplicate long std::function repetition We can just use type aliases to avoid needing to write the same long type twice --- src/audio_core/sink_details.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/audio_core/sink_details.h b/src/audio_core/sink_details.h index 4f9027762..ea666c554 100644 --- a/src/audio_core/sink_details.h +++ b/src/audio_core/sink_details.h @@ -14,16 +14,18 @@ namespace AudioCore { class Sink; struct SinkDetails { - SinkDetails(const char* id_, std::function(std::string)> factory_, - std::function()> list_devices_) + using FactoryFn = std::function(std::string)>; + using ListDevicesFn = std::function()>; + + SinkDetails(const char* id_, FactoryFn factory_, ListDevicesFn list_devices_) : id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {} /// Name for this sink. const char* id; /// A method to call to construct an instance of this type of sink. - std::function(std::string device_id)> factory; + FactoryFn factory; /// A method to call to list available devices. - std::function()> list_devices; + ListDevicesFn list_devices; }; extern const std::vector g_sink_details; -- cgit v1.2.3