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