From 4bcc5e71fcdbdda31705644aa9c76d05cd922742 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 8 Jan 2014 00:47:39 +0900 Subject: [PATCH] add workaround for clang3.4 or later: base class construct --- sprout/container/container_traits.hpp | 20 ++++++++++- sprout/workaround/base_class_construct.hpp | 39 ++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 sprout/workaround/base_class_construct.hpp diff --git a/sprout/container/container_traits.hpp b/sprout/container/container_traits.hpp index 636e3bbd..d6223e47 100644 --- a/sprout/container/container_traits.hpp +++ b/sprout/container/container_traits.hpp @@ -20,6 +20,7 @@ #if SPROUT_USE_PTR_INDEX_ITERATOR_IMPLEMENTATION # include #endif +#include namespace sprout { template @@ -520,7 +521,24 @@ namespace sprout { , public sprout::detail::inherit_if_const_pointer > , public sprout::detail::inherit_if_static_size > , public sprout::detail::container_nosy_fixed_size > - {}; + { +#if SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT + public: + SPROUT_CONSTEXPR container_traits_facade() + : SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_value_type >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_iterator >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_const_iterator >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_reference >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_const_reference >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_size_type >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_difference_type >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_pointer >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_const_pointer >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::inherit_if_static_size >) + , SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(sprout::detail::container_nosy_fixed_size >) + {} +#endif + }; // // is_fixed_container diff --git a/sprout/workaround/base_class_construct.hpp b/sprout/workaround/base_class_construct.hpp new file mode 100644 index 00000000..e20e7ce6 --- /dev/null +++ b/sprout/workaround/base_class_construct.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + Copyright (c) 2011-2013 Bolero MURAKAMI + https://github.com/bolero-MURAKAMI/Sprout + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ +#ifndef SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP +#define SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP + +#include + +// +// SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +// +#ifndef SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +# if defined(__clang__) +# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) +# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 1 +# else +# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 0 +# endif +# else +# define SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT 0 +# endif +#endif + +// +// SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +// +#ifndef SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +# if SPROUT_NEEDS_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT +# define SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(base) base() +# else +# define SPROUT_EXPLICIT_EMPTY_BASE_CLASS_CONSTRUCT(base) +# endif +#endif + +#endif // #ifndef SPROUT_WORKAROUND_BASE_CLASS_CONSTRUCT_HPP