vector_promotions.h

Go to the documentation of this file.
00001 /* -*- C++ -*- ------------------------------------------------------------
00002  
00003 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
00004 
00005 The Configurable Math Library (CML) is distributed under the terms of the
00006 Boost Software License, v1.0 (see cml/LICENSE for details).
00007 
00008  *-----------------------------------------------------------------------*/
00018 #ifndef vector_promotions_h
00019 #define vector_promotions_h
00020 
00021 #include <cml/et/scalar_promotions.h>
00022 #include <cml/et/array_promotions.h>
00023 
00024 namespace cml {
00025 namespace et {
00026 
00027 /* Default vector type promotion template. */
00028 template<class LeftT, class RightT> struct VectorPromote;
00029 
00031 template<typename E1, class AT1, typename E2, class AT2>
00032 struct VectorPromote< cml::vector<E1,AT1>, cml::vector<E2,AT2> >
00033 {
00034     typedef typename ArrayPromote<
00035         typename cml::vector<E1,AT1>::array_type,
00036         typename cml::vector<E2,AT2>::array_type
00037     >::type promoted_array;
00038 
00039     /* The deduced vector result type: */
00040     typedef cml::vector<
00041         typename promoted_array::value_type,
00042         typename promoted_array::generator_type
00043     > type;
00044 
00045     /* The deduced temporary type: */
00046     typedef typename type::temporary_type temporary_type;
00047 };
00048 
00050 template<typename E, class AT, typename S>
00051 struct VectorPromote<cml::vector<E,AT>, S>
00052 {
00053     /* The deduced vector result type (the array type is the same): */
00054     typedef cml::vector<typename ScalarPromote<E,S>::type, AT> type;
00055 
00056     /* The deduced temporary type: */
00057     typedef typename type::temporary_type temporary_type;
00058 };
00059 
00061 template<typename S, typename E, class AT>
00062 struct VectorPromote<S, cml::vector<E,AT> >
00063 {
00064     /* The deduced vector result type (the array type is the same): */
00065     typedef cml::vector<typename ScalarPromote<S,E>::type, AT> type;
00066 
00067     /* The deduced temporary type: */
00068     typedef typename type::temporary_type temporary_type;
00069 };
00070 
00071 } // namespace et
00072 } // namespace cml
00073 
00074 #endif
00075 
00076 // -------------------------------------------------------------------------
00077 // vim:ft=cpp

Generated on Sat Jul 18 19:35:35 2009 for CML 1.0 by  doxygen 1.5.9