annotate armadillo-3.900.4/include/armadillo_bits/span.hpp @ 76:a595de3e6f8d
Fix invalid call to parts.erase(parts.end()), which can crash and never does anything good. I think this is the intended behaviour.
author |
Chris Cannam |
date |
Thu, 24 Jan 2019 15:07:04 +0000 |
parents |
1ec0e2823891 |
children |
|
rev |
line source |
Chris@49
|
1 // Copyright (C) 2010-2012 NICTA (www.nicta.com.au)
|
Chris@49
|
2 // Copyright (C) 2010-2012 Conrad Sanderson
|
Chris@49
|
3 // Copyright (C) 2011 Stanislav Funiak
|
Chris@49
|
4 //
|
Chris@49
|
5 // This Source Code Form is subject to the terms of the Mozilla Public
|
Chris@49
|
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
|
Chris@49
|
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
Chris@49
|
8
|
Chris@49
|
9
|
Chris@49
|
10
|
Chris@49
|
11 //! \addtogroup span
|
Chris@49
|
12 //! @{
|
Chris@49
|
13
|
Chris@49
|
14
|
Chris@49
|
15 struct span_alt {};
|
Chris@49
|
16
|
Chris@49
|
17
|
Chris@49
|
18 template<typename Dummy = int>
|
Chris@49
|
19 class span_base
|
Chris@49
|
20 {
|
Chris@49
|
21 public:
|
Chris@49
|
22 static const span_alt all;
|
Chris@49
|
23 };
|
Chris@49
|
24
|
Chris@49
|
25
|
Chris@49
|
26 template<typename Dummy>
|
Chris@49
|
27 const span_alt span_base<Dummy>::all = span_alt();
|
Chris@49
|
28
|
Chris@49
|
29
|
Chris@49
|
30 class span : public span_base<>
|
Chris@49
|
31 {
|
Chris@49
|
32 public:
|
Chris@49
|
33
|
Chris@49
|
34 uword a;
|
Chris@49
|
35 uword b;
|
Chris@49
|
36 bool whole;
|
Chris@49
|
37
|
Chris@49
|
38 inline
|
Chris@49
|
39 span()
|
Chris@49
|
40 : whole(true)
|
Chris@49
|
41 {
|
Chris@49
|
42 }
|
Chris@49
|
43
|
Chris@49
|
44
|
Chris@49
|
45 inline
|
Chris@49
|
46 span(const span_alt&)
|
Chris@49
|
47 : whole(true)
|
Chris@49
|
48 {
|
Chris@49
|
49 }
|
Chris@49
|
50
|
Chris@49
|
51 // TODO:
|
Chris@49
|
52 // if the "explicit" keyword is removed or commented out,
|
Chris@49
|
53 // the compiler will be able to automatically convert integers to an instance of the span class.
|
Chris@49
|
54 // this is useful for Cube::operator()(span&, span&, span&),
|
Chris@49
|
55 // but it might have unintended consequences or interactions elsewhere.
|
Chris@49
|
56 // as such, removal of "explicit" needs thorough testing.
|
Chris@49
|
57 inline
|
Chris@49
|
58 explicit
|
Chris@49
|
59 span(const uword in_a)
|
Chris@49
|
60 : a(in_a)
|
Chris@49
|
61 , b(in_a)
|
Chris@49
|
62 , whole(false)
|
Chris@49
|
63 {
|
Chris@49
|
64 }
|
Chris@49
|
65
|
Chris@49
|
66
|
Chris@49
|
67 #if defined(ARMA_USE_CXX11)
|
Chris@49
|
68 span(const double in_a) = delete;
|
Chris@49
|
69 #endif
|
Chris@49
|
70
|
Chris@49
|
71
|
Chris@49
|
72 inline
|
Chris@49
|
73 span(const uword in_a, const uword in_b)
|
Chris@49
|
74 : a(in_a)
|
Chris@49
|
75 , b(in_b)
|
Chris@49
|
76 , whole(false)
|
Chris@49
|
77 {
|
Chris@49
|
78 }
|
Chris@49
|
79
|
Chris@49
|
80 };
|
Chris@49
|
81
|
Chris@49
|
82
|
Chris@49
|
83
|
Chris@49
|
84 //! @}
|