std_valarray.hpp

Go to the documentation of this file.
00001 /*
00002  * 
00003  * Copyright (c) 2002, 2003 Kresimir Fresl, Toon Knapen and Karl Meerbergen
00004  *
00005  * Permission to copy, modify, use and distribute this software 
00006  * for any non-commercial or commercial purpose is granted provided 
00007  * that this license appear on all copies of the software source code.
00008  *
00009  * Authors assume no responsibility whatsoever for its use and makes 
00010  * no guarantees about its quality, correctness or reliability.
00011  *
00012  * KF acknowledges the support of the Faculty of Civil Engineering, 
00013  * University of Zagreb, Croatia.
00014  *
00015  */
00016 
00017 #ifndef BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY_H
00018 #define BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY_H
00019 
00020 #include <boost/numeric/bindings/traits/config.hpp> 
00021 
00022 #ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 
00023 
00024 #include <boost/numeric/bindings/traits/vector_traits.hpp>
00025 #include <valarray>
00026 
00027 
00028 namespace boost { namespace numeric { namespace bindings { namespace traits {
00029 
00030   // std::valarray<>
00031   template <typename T, typename V> 
00032   struct vector_detail_traits<std::valarray<T>, V> 
00033   : default_vector_traits<V, T> 
00034   {
00035 
00036 #ifndef BOOST_NUMERIC_BINDINGS_NO_SANITY_CHECK
00037     BOOST_STATIC_ASSERT( 
00038       (boost::is_same< 
00039          std::valarray<T>, typename boost::remove_const<V>::type 
00040        >::value) 
00041     );
00042 #endif
00043 
00044     typedef std::valarray<T> identifier_type; 
00045     typedef V vector_type;
00046     typedef typename default_vector_traits<V, T>::pointer pointer;
00047 
00048     static pointer storage (vector_type& va) { 
00049       std::valarray<T>& ncva = const_cast<std::valarray<T>&> (va);
00050       return &ncva[0];
00051     }
00052   }; 
00053 
00054 }}}}  
00055 
00056 #else // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 
00057 
00058 #error with your compiler std::valarray<> cannot be used in bindings
00059 
00060 #endif // BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS 
00061 
00062 #endif // BOOST_NUMERIC_BINDINGS_TRAITS_STD_VALARRAY_H

Generated on Wed Nov 23 19:00:41 2011 for FreeCAD by  doxygen 1.6.1