From 4e680cc43fafbbc986b765c0fce240497b28c97f Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Wed, 7 Jul 2021 18:25:06 +0200 Subject: [PATCH] provide boost::mp11::mp_flatten if boost is too old --- include/llama/Meta.hpp | 51 +++++++++++++++++++++++++++++++++++++++++ include/llama/llama.hpp | 1 + 2 files changed, 52 insertions(+) create mode 100644 include/llama/Meta.hpp diff --git a/include/llama/Meta.hpp b/include/llama/Meta.hpp new file mode 100644 index 0000000000..0cf1673dc6 --- /dev/null +++ b/include/llama/Meta.hpp @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include + +#if BOOST_MP11_VERSION < 107300 +// Copyright 2015 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// Boost Software License - Version 1.0 - August 17th, 2003 +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +namespace boost::mp11 +{ + namespace detail + { + template + struct mp_flatten_impl + { + template + using fn = mp_if, T, mp_list>; + }; + } // namespace detail + + template > + using mp_flatten = mp_apply, L>, mp_clear>>; +} // namespace boost::mp11 +#endif diff --git a/include/llama/llama.hpp b/include/llama/llama.hpp index fa135dc765..600122ff8c 100644 --- a/include/llama/llama.hpp +++ b/include/llama/llama.hpp @@ -35,6 +35,7 @@ #include "BlobAllocators.hpp" #include "Copy.hpp" #include "Core.hpp" +#include "Meta.hpp" #include "Vector.hpp" #include "View.hpp" #include "VirtualRecord.hpp"