From ccbd86c9ef27e525920c3d65e1891a05b6fb0c7e Mon Sep 17 00:00:00 2001 From: Munken Date: Sun, 14 May 2017 22:19:11 +0200 Subject: [PATCH] C++11 support --- Makefile | 2 +- ponymix.cc | 1 + unique_polyfill.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 unique_polyfill.h diff --git a/Makefile b/Makefile index 57697c3..290a67d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ ifneq "$(VDEVEL)" "" V=$(VDEVEL) endif -base_CXXFLAGS = -std=c++14 -Wall -Wextra -pedantic -O2 -g -DPONYMIX_VERSION=\"$(V)\" +base_CXXFLAGS = -std=c++11 -Wall -Wextra -pedantic -O2 -g -DPONYMIX_VERSION=\"$(V)\" base_LIBS = -lm libpulse_CXXFLAGS = $(shell pkg-config --cflags libpulse) diff --git a/ponymix.cc b/ponymix.cc index 654d1af..634460a 100644 --- a/ponymix.cc +++ b/ponymix.cc @@ -1,4 +1,5 @@ #include "pulse.h" +#include "unique_polyfill.h" #include #include diff --git a/unique_polyfill.h b/unique_polyfill.h new file mode 100644 index 0000000..9e6e8ba --- /dev/null +++ b/unique_polyfill.h @@ -0,0 +1,15 @@ +#pragma once + +// MSVS defines this already. +// http://stackoverflow.com/questions/14131454/visual-studio-2012-cplusplus-and-c-11 +#if defined(_MSC_VER) && _MSC_VER < 1800 || !defined(_MSC_VER) && __cplusplus <= 201103L +#include +#include +namespace std { + // C++14 backfill from http://herbsutter.com/gotw/_102/ + template + inline std::unique_ptr make_unique(Args&& ...args) { + return std::unique_ptr(new T(std::forward(args)...)); + } +} +#endif