From 241576ce1d1538537d18daff8dd1365ca01feb68 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Thu, 21 Jan 2016 16:14:20 +0100 Subject: [PATCH] container: support non-default VectorAbi + better docs Signed-off-by: Matthias Kretz --- common/makeContainer.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/common/makeContainer.h b/common/makeContainer.h index a76f2be21..1ce1fc6c4 100644 --- a/common/makeContainer.h +++ b/common/makeContainer.h @@ -43,10 +43,11 @@ namespace Vc_VERSIONED_NAMESPACE static constexpr Container help(std::initializer_list list) { return { list }; } }; - template class Container> - struct make_container_helper, Alloc>, typename ::Vc::Vector<_T>::EntryType> - { - typedef ::Vc::Vector<_T> V; + template class Container> + struct make_container_helper, Alloc>, + typename Vector::EntryType> { + typedef Vector V; typedef typename V::EntryType T; typedef Container C; static inline C help(std::initializer_list list) { @@ -68,10 +69,11 @@ namespace Vc_VERSIONED_NAMESPACE } }; - template class Container> - struct make_container_helper, N>, typename ::Vc::Vector<_T>::EntryType> - { - typedef ::Vc::Vector<_T> V; + template class Container> + struct make_container_helper, N>, + typename Vector::EntryType> { + typedef Vector V; typedef typename V::EntryType T; static constexpr std::size_t size = (N + (V::Size - 1)) / V::Size; typedef Container C; @@ -102,13 +104,20 @@ namespace Vc_VERSIONED_NAMESPACE * * Construct a container of Vc vectors from a std::initializer_list of scalar entries. * + * \tparam Container The container type to construct. + * \tparam T The scalar type to use for the initializer_list. + * * \param list An initializer list of arbitrary size. The type of the entries is important! * If you pass a list of integers you will get a container filled with Vc::int_v objects. * If, instead, you want to have a container of Vc::float_v objects, be sure the include a - * period (.) and the 'f' postfix in the literals. + * period (.) and the 'f' postfix in the literals. Alternatively, you can pass the + * type as second template argument to makeContainer. * * \return Returns a container of the requested class filled with the minimum number of SIMD * vectors to hold the values in the initializer list. + * If the number of values in \p list does not match the number of values in the + * returned container object, the remaining values in the returned object will be + * zero-initialized. * * Example: * \code