1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 
20 //! \addtogroup span
21 //! @{
22 
23 
24 struct span_alt {};
25 
26 
27 template<typename junk = int>
28 class span_base
29   {
30   public:
31   static const span_alt all;
32   };
33 
34 
35 template<typename junk>
36 const span_alt span_base<junk>::all = span_alt();
37 
38 
39 class span : public span_base<>
40   {
41   public:
42 
43   uword a;
44   uword b;
45   bool  whole;
46 
47   inline
span()48   span()
49     : a(0)
50     , b(0)
51     , whole(true)
52     {
53     }
54 
55 
56   inline
span(const span_alt &)57   span(const span_alt&)
58     : a(0)
59     , b(0)
60     , whole(true)
61     {
62     }
63 
64 
65   inline
66   explicit
span(const uword in_a)67   span(const uword in_a)
68     : a(in_a)
69     , b(in_a)
70     , whole(false)
71     {
72     }
73 
74 
75   // the "explicit" keyword is required here to prevent automatic conversion of {a,b}
76   // into an instance of span() when submatrices are specified
77   inline
78   explicit
span(const uword in_a,const uword in_b)79   span(const uword in_a, const uword in_b)
80     : a(in_a)
81     , b(in_b)
82     , whole(false)
83     {
84     }
85 
86   };
87 
88 
89 
90 //! @}
91