• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List

/export/development/ViennaMath/viennamath/compiletime/ct_constant.hpp

Go to the documentation of this file.
00001 #ifndef VIENNAMATH_COMPILETIME_CT_CONSTANT_HPP
00002 #define VIENNAMATH_COMPILETIME_CT_CONSTANT_HPP
00003 
00004 /* =======================================================================
00005    Copyright (c) 2012, Institute for Microelectronics,
00006                        Institute for Analysis and Scientific Computing,
00007                        TU Wien.
00008                              -----------------
00009                ViennaMath - Symbolic and Numerical Math in C++
00010                              -----------------
00011 
00012    Author:     Karl Rupp                          rupp@iue.tuwien.ac.at
00013 
00014    License:    MIT (X11), see file LICENSE in the ViennaMath base directory
00015 ======================================================================= */
00016 
00017 
00018 
00019 
00020 #include <ostream>
00021 #include "viennamath/forwards.h"
00022 
00027 namespace viennamath
00028 {
00029   
00034   template <long value_>
00035   class ct_constant
00036   {    
00037       typedef ct_constant<value_>     self_type;
00038     public:
00039       explicit ct_constant() {};
00040       
00041       self_type operator() () const { return *this; }
00042 
00043       template <typename VectorType>
00044       self_type operator() (const VectorType & p) const { return *this; }
00045       
00047       operator long() const { return value_; }
00048       
00049       std::string str() const
00050       {
00051         std::stringstream ss;
00052         ss << "ct_constant<" << value_ << ">";
00053         return ss.str();      
00054       }
00055       
00056   };
00057 
00059   template <long value_>
00060   std::ostream& operator<<(std::ostream & stream,
00061                            ct_constant<value_> const & c)
00062   {
00063     stream << c.str();
00064     return stream;
00065   }
00066   
00067   
00068   
00069   
00070   
00071 }
00072 
00073 #endif

Generated on Wed Feb 29 2012 21:50:43 for ViennaMath by  doxygen 1.7.1