From 841f391a8fa3b0f570c8c5692d19b3bfc3b21054 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 26 Feb 2016 07:17:31 +0000 Subject: compat,cli: Add std::to_string on Android to fix build. --- compat/cxx_compat.hpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 compat/cxx_compat.hpp (limited to 'compat') diff --git a/compat/cxx_compat.hpp b/compat/cxx_compat.hpp new file mode 100644 index 00000000..1f67fb17 --- /dev/null +++ b/compat/cxx_compat.hpp @@ -0,0 +1,50 @@ +/************************************************************************** + * + * Copyright 2016 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + **************************************************************************/ + +/* + * C++ compatibility helpers. + */ + +#pragma once + + +/* + * Emulate std::to_string on Android + * + * XXX: There might be different solutions per + * http://stackoverflow.com/questions/26095886/error-to-string-is-not-a-member-of-std + */ +#ifdef ANDROID +#include +#include +namespace std { + template< typename T > + string to_string(const T & value) { + ostringstream ss; + ss << value; + return ss.str(); + } +} +#endif /* ANDROID */ -- cgit v1.2.3