diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-02-26 07:17:31 +0000 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-02-26 07:23:00 +0000 |
commit | 841f391a8fa3b0f570c8c5692d19b3bfc3b21054 (patch) | |
tree | 5417794bad437ca3c0567031c2886ffc4420920d /compat | |
parent | 71a85c9d1c585630bb8742510712cfbde3a9b49d (diff) |
compat,cli: Add std::to_string on Android to fix build.
Diffstat (limited to 'compat')
-rw-r--r-- | compat/cxx_compat.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
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 <string> +#include <sstream> +namespace std { + template< typename T > + string to_string(const T & value) { + ostringstream ss; + ss << value; + return ss.str(); + } +} +#endif /* ANDROID */ |