Vc  1.4.1
SIMD Vector Classes for C++
vector
1 /*{{{
2  Copyright © 2013 Matthias Kretz <kretz@kde.org>
3 
4  Permission to use, copy, modify, and distribute this software
5  and its documentation for any purpose and without fee is hereby
6  granted, provided that the above copyright notice appear in all
7  copies and that both that the copyright notice and this
8  permission notice and warranty disclaimer appear in supporting
9  documentation, and that the name of the author not be used in
10  advertising or publicity pertaining to distribution of the
11  software without specific, written prior permission.
12 
13  The author disclaim all warranties with regard to this
14  software, including all implied warranties of merchantability
15  and fitness. In no event shall the author be liable for any
16  special, indirect or consequential damages or any damages
17  whatsoever resulting from loss of use, data or profits, whether
18  in an action of contract, negligence or other tortious action,
19  arising out of or in connection with the use or performance of
20  this software.
21 
22 }}}*/
23 
24 #ifndef VC_VECTOR_
25 #define VC_VECTOR_
26 
27 #include "common/subscript.h"
28 #include <vector>
29 
30 namespace Vc_VERSIONED_NAMESPACE
31 {
32 /**
33  * \ingroup Containers
34  * \headerfile vector <Vc/vector>
35  *
36  * An adapted `std::vector` container with an additional subscript operator which
37  * implements gather and scatter operations.
38  *
39  * The [std::vector](https://en.cppreference.com/w/cpp/container/vector) documentation applies.
40  *
41  * Example:
42  * \code
43  * struct Point {
44  * float x, y;
45  * };
46  * Vc::vector<Point> data;
47  * data.resize(100);
48  * // initialize values in data
49  * float_v::IndexType indexes = ...; // values between 0-99
50  * float_v x = data[indexes][&Point::x];
51  * float_v y = data[indexes][&Point::y];
52  * \endcode
53  */
54 template <typename T, typename Allocator = std::allocator<T>>
55 using vector = Common::AdaptSubscriptOperator<std::vector<T, Allocator>>;
56 
57 namespace Traits
58 {
59 template <typename T, typename A>
60 struct has_contiguous_storage_impl<Vc::vector<T, A>> : public std::true_type {};
61 } // namespace Traits
62 
63 } // namespace
64 
65 #endif // VC_VECTOR_
66 // vim: ft=cpp