00001 // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2010-2011 Conrad Sanderson 00003 // Copyright (C) 2011 Stanislav Funiak 00004 // 00005 // This file is part of the Armadillo C++ library. 00006 // It is provided without any warranty of fitness 00007 // for any purpose. You can redistribute this file 00008 // and/or modify it under the terms of the GNU 00009 // Lesser General Public License (LGPL) as published 00010 // by the Free Software Foundation, either version 3 00011 // of the License or (at your option) any later version. 00012 // (see http://www.opensource.org/licenses for more info) 00013 00014 00015 00018 00019 00020 struct span_alt {}; 00021 00022 00023 template<typename Dummy = int> 00024 class span_base 00025 { 00026 public: 00027 static const span_alt all; 00028 }; 00029 00030 00031 template<typename Dummy> 00032 const span_alt span_base<Dummy>::all = span_alt(); 00033 00034 00035 class span : public span_base<> 00036 { 00037 public: 00038 00039 uword a; 00040 uword b; 00041 bool whole; 00042 00043 inline 00044 span() 00045 : whole(true) 00046 { 00047 } 00048 00049 00050 inline 00051 span(const span_alt&) 00052 : whole(true) 00053 { 00054 } 00055 00056 // TODO: 00057 // if the "explicit" keyword is removed or commented out, 00058 // the compiler will be able to automatically convert integers to an instance of the span class. 00059 // this is useful for Cube::operator()(span&, span&, span&), 00060 // but it might have unintended consequences or interactions elsewhere. 00061 // as such, removal of "explicit" needs thorough testing. 00062 inline 00063 explicit 00064 span(const uword in_a) 00065 : a(in_a) 00066 , b(in_a) 00067 , whole(false) 00068 { 00069 } 00070 00071 inline 00072 span(const uword in_a, const uword in_b) 00073 : a(in_a) 00074 , b(in_b) 00075 , whole(false) 00076 { 00077 } 00078 00079 }; 00080 00081 00082