comparison armadillo-2.4.4/include/armadillo_bits/span.hpp @ 0:8b6102e2a9b0

Armadillo Library
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 09:27:06 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8b6102e2a9b0
1 // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
2 // Copyright (C) 2010-2011 Conrad Sanderson
3 // Copyright (C) 2011 Stanislav Funiak
4 //
5 // This file is part of the Armadillo C++ library.
6 // It is provided without any warranty of fitness
7 // for any purpose. You can redistribute this file
8 // and/or modify it under the terms of the GNU
9 // Lesser General Public License (LGPL) as published
10 // by the Free Software Foundation, either version 3
11 // of the License or (at your option) any later version.
12 // (see http://www.opensource.org/licenses for more info)
13
14
15
16 //! \addtogroup span
17 //! @{
18
19
20 struct span_alt {};
21
22
23 template<typename Dummy = int>
24 class span_base
25 {
26 public:
27 static const span_alt all;
28 };
29
30
31 template<typename Dummy>
32 const span_alt span_base<Dummy>::all = span_alt();
33
34
35 class span : public span_base<>
36 {
37 public:
38
39 uword a;
40 uword b;
41 bool whole;
42
43 inline
44 span()
45 : whole(true)
46 {
47 }
48
49
50 inline
51 span(const span_alt&)
52 : whole(true)
53 {
54 }
55
56 // TODO:
57 // if the "explicit" keyword is removed or commented out,
58 // the compiler will be able to automatically convert integers to an instance of the span class.
59 // this is useful for Cube::operator()(span&, span&, span&),
60 // but it might have unintended consequences or interactions elsewhere.
61 // as such, removal of "explicit" needs thorough testing.
62 inline
63 explicit
64 span(const uword in_a)
65 : a(in_a)
66 , b(in_a)
67 , whole(false)
68 {
69 }
70
71 inline
72 span(const uword in_a, const uword in_b)
73 : a(in_a)
74 , b(in_b)
75 , whole(false)
76 {
77 }
78
79 };
80
81
82
83 //! @}