std_valarray.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
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
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