type_pair_traits.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002     
00003     type_pair_traits.hpp -- additional information about pair of types.
00004 
00005     This file is part of the Arageli library.
00006 
00007     Copyright (C) Nikolai Yu. Zolotykh, 1999--2006
00008     Copyright (C) Sergey S. Lyalin, 2005--2006
00009     University of Nizhni Novgorod, Russia
00010 
00011 *****************************************************************************/
00012 
00024 #ifndef _ARAGELI_type_pair_traits_hpp_
00025 #define _ARAGELI_type_pair_traits_hpp_
00026 
00027 #include "config.hpp"
00028 
00029 #include <limits>
00030 
00031 #include "type_traits.hpp"
00032 
00033 
00034 //****************************************************************************
00035 
00036 
00037 namespace Arageli
00038 {
00039 
00041 template <typename T1, typename T2>
00042 struct type_pair_traits_default
00043 {
00045     static const bool is_specialized = false;
00046 
00048     static const bool is_convertible = false;
00049 
00052     static const bool is_safe_convertible = false;
00053     
00055     static const bool is_assignable = false;
00056 
00059     static const bool is_safe_assignable = false;
00060     
00062     static const bool is_initializable = false;
00063 
00066     static const bool is_safe_initializable = false;
00067 };
00068 
00069 
00070 template <typename T1, typename T2>
00071 struct type_pair_traits;
00072 
00073 
00074 template <typename T1, typename T2, bool ISAGR1, bool ISAGR2>
00075 struct type_pair_traits_helper;
00076 
00077 template <typename T1, typename T2>
00078 struct type_pair_traits_helper<T1, T2, true, true>
00079 {
00080 private:
00081 
00082     typedef type_traits<T1> TT1;
00083     typedef type_traits<T2> TT2;
00084     typedef typename type_traits<T1>::element_type TE1;
00085     typedef typename type_traits<T2>::element_type TE2;
00086 
00087 public:
00088 
00089     static const bool is_specialized =
00090         TT1::is_specialized && TT2::is_specialized;
00091 
00092     static const bool is_convertible =
00093         type_pair_traits<T1, TE2>::is_convertible
00094         ||
00095             type_pair_traits<TE1, TE2>::is_convertible &&
00096             !type_pair_traits<T1, TE2>::is_convertible &&
00097             TT1::is_rational == TT2::is_rational &&
00098             TT1::is_vector == TT2::is_vector &&
00099             TT1::is_matrix == TT2::is_matrix &&
00100             TT1::is_complex_number == TT2::is_complex_number &&
00101             TT1::is_polynom == TT2::is_polynom
00102         ||
00103         TT1::is_rational &&
00104             type_pair_traits<TE1, T2>::is_convertible;
00105 
00106     static const bool is_safe_convertible =
00107         type_pair_traits<T1, TE2>::is_safe_convertible
00108         ||
00109             type_pair_traits<TE1, TE2>::is_safe_convertible &&
00110             !type_pair_traits<T1, TE2>::is_safe_convertible &&
00111             TT1::is_rational == TT2::is_rational &&
00112             TT1::is_vector == TT2::is_vector &&
00113             TT1::is_matrix == TT2::is_matrix &&
00114             TT1::is_complex_number == TT2::is_complex_number &&
00115             TT1::is_polynom == TT2::is_polynom;
00116 
00117     static const bool is_assignable =
00118         type_pair_traits<T1, TE2>::is_assignable
00119         ||
00120             type_pair_traits<TE1, TE2>::is_assignable &&
00121             !type_pair_traits<T1, TE2>::is_assignable &&
00122             TT1::is_rational == TT2::is_rational &&
00123             TT1::is_vector == TT2::is_vector &&
00124             TT1::is_matrix == TT2::is_matrix &&
00125             TT1::is_complex_number == TT2::is_complex_number &&
00126             TT1::is_polynom == TT2::is_polynom
00127         ||
00128         TT1::is_rational &&
00129             type_pair_traits<TE1, T2>::is_assignable;
00130 
00131     static const bool is_safe_assignable =
00132         type_pair_traits<T1, TE2>::is_safe_assignable
00133         ||
00134             type_pair_traits<TE1, TE2>::is_safe_assignable &&
00135             !type_pair_traits<T1, TE2>::is_safe_assignable &&
00136             TT1::is_rational == TT2::is_rational &&
00137             TT1::is_vector == TT2::is_vector &&
00138             TT1::is_matrix == TT2::is_matrix &&
00139             TT1::is_complex_number == TT2::is_complex_number &&
00140             TT1::is_polynom == TT2::is_polynom;
00141 
00142     static const bool is_initializable =
00143         type_pair_traits<T1, TE2>::is_initializable
00144         ||
00145             type_pair_traits<TE1, TE2>::is_initializable &&
00146             !type_pair_traits<T1, TE2>::is_initializable &&
00147             TT1::is_rational == TT2::is_rational &&
00148             TT1::is_vector == TT2::is_vector &&
00149             TT1::is_matrix == TT2::is_matrix &&
00150             TT1::is_complex_number == TT2::is_complex_number &&
00151             TT1::is_polynom == TT2::is_polynom
00152         ||
00153         TT1::is_rational &&
00154             type_pair_traits<TE1, T2>::is_initializable;
00155 
00156     static const bool is_safe_initializable =
00157         type_pair_traits<T1, TE2>::is_safe_initializable
00158         ||
00159             type_pair_traits<TE1, TE2>::is_safe_initializable &&
00160             !type_pair_traits<T1, TE2>::is_safe_initializable &&
00161             TT1::is_rational == TT2::is_rational &&
00162             TT1::is_vector == TT2::is_vector &&
00163             TT1::is_matrix == TT2::is_matrix &&
00164             TT1::is_complex_number == TT2::is_complex_number &&
00165             TT1::is_polynom == TT2::is_polynom;
00166 };
00167 
00168 
00169 template <typename T1, typename T2>
00170 struct type_pair_traits_helper<T1, T2, true, false>
00171 {
00172 private:
00173 
00174     typedef type_traits<T1> TT1;
00175     typedef type_traits<T2> TT2;
00176     typedef typename type_traits<T1>::element_type TE1;
00177 
00178 public:
00179 
00180     static const bool is_specialized =
00181         TT1::is_specialized && TT2::is_specialized;
00182 
00183     static const bool is_convertible =
00184         TT1::is_rational &&
00185         type_pair_traits<TE1, T2>::is_convertible;
00186 
00187     static const bool is_safe_convertible = false;
00188 
00189     static const bool is_assignable =
00190         TT1::is_rational &&
00191         type_pair_traits<TE1, T2>::is_assignable;
00192 
00193     static const bool is_safe_assignable = false;
00194 
00195     static const bool is_initializable =
00196         TT1::is_rational &&
00197         type_pair_traits<TE1, T2>::is_initializable;
00198 
00199     static const bool is_safe_initializable = false;
00200 };
00201 
00202 
00203 template <typename T1, typename T2>
00204 struct type_pair_traits_helper<T1, T2, false, true>
00205 {
00206 private:
00207 
00208     typedef type_traits<T1> TT1;
00209     typedef type_traits<T2> TT2;
00210     typedef typename type_traits<T2>::element_type TE2;
00211 
00212 public:
00213 
00214     static const bool is_specialized =
00215         TT1::is_specialized && TT2::is_specialized;
00216 
00217     static const bool is_convertible =
00218         type_pair_traits<T1, TE2>::is_convertible;
00219 
00220     static const bool is_safe_convertible =
00221         type_pair_traits<T1, TE2>::is_safe_convertible;
00222 
00223     static const bool is_assignable =
00224         type_pair_traits<T1, TE2>::is_assignable;
00225 
00226     static const bool is_safe_assignable =
00227         type_pair_traits<T1, TE2>::is_safe_assignable;
00228 
00229     static const bool is_initializable =
00230         type_pair_traits<T1, TE2>::is_initializable;
00231 
00232     static const bool is_safe_initializable =
00233         type_pair_traits<T1, TE2>::is_safe_initializable;
00234 };
00235 
00236 
00237 template <typename T1, typename T2>
00238 struct type_pair_traits_helper<T1, T2, false, false>
00239 {
00240 private:
00241 
00242     typedef type_traits<T1> TT1;
00243     typedef type_traits<T2> TT2;
00244     typedef std::numeric_limits<T1> NL1;
00245     typedef std::numeric_limits<T2> NL2;
00246 
00247 public:
00248 
00249     static const bool is_specialized =
00250         TT1::is_specialized && TT2::is_specialized;
00251 
00252     static const bool is_convertible =
00253         TT1::is_number && TT2::is_number;
00254 
00255     static const bool is_safe_convertible =
00256         is_convertible &&
00257         (!(NL1::is_signed && !NL2::is_signed)) &&
00258         (!(!NL1::is_integer && NL2::is_integer)) &&
00259         (
00260             NL1::is_bounded && NL2::is_bounded && (NL1::digits <= NL2::digits) ||
00261             NL1::is_bounded && !NL2::is_bounded
00262         );
00263         
00264     static const bool is_assignable = is_convertible;
00265     static const bool is_safe_assignable = is_safe_convertible;
00266     static const bool is_initializable = is_convertible;
00267     static const bool is_safe_initializable = is_safe_convertible;
00268 };
00269 
00270 
00272 template <typename T1, typename T2>
00273 struct type_pair_traits :
00274     public type_pair_traits_helper
00275         <T1, T2, type_traits<T1>::is_aggregate, type_traits<T2>::is_aggregate>
00276 {
00277 private:
00278 
00279 };
00280 
00281 
00283 template <typename T>
00284 struct type_pair_traits_for_the_same
00285 {
00286     static const bool is_specialized = true;
00287     static const bool is_convertible = true;
00288     static const bool is_safe_convertible = true;
00289     static const bool is_assignable = true;
00290     static const bool is_safe_assignable = true;
00291     static const bool is_initializable = true;
00292     static const bool is_safe_initializable = true;
00293 };
00294 
00295 
00297 template <typename T>
00298 struct type_pair_traits<T, T> :
00299     public type_pair_traits_for_the_same<T> {};
00300 
00301 
00302 #if 0
00303 
00305 template <typename T1, typename T2>
00306 struct type_pair_traits_for_similar_aggregates
00307 {
00308 protected:
00309 
00310     typedef typename type_traits<T1>::element_type TE1;
00311     typedef typename type_traits<T2>::element_type TE2;
00312 
00313 public:
00314 
00315     static const bool is_specialized =
00316         type_traits<T1>::is_specialized &&
00317         type_traits<T2>::is_specialized &&
00318         type_pair_traits<TE1, TE2>::is_specialized;
00319 
00320     static const bool is_convertible =
00321         type_pair_traits<TE1, TE2>::is_convertible;
00322 
00323     static const bool is_safe_convertible =
00324         type_pair_traits<TE1, TE2>::is_safe_convertible;
00325     
00326     static const bool is_assignable =
00327         type_pair_traits<TE1, TE2>::is_assignable;
00328 
00329     static const bool is_safe_assignable =
00330         type_pair_traits<TE1, TE2>::is_safe_assignable;
00331     
00332     static const bool is_initializable =
00333         type_pair_traits<TE1, TE2>::is_initializable;
00334 
00335     static const bool is_safe_initializable =
00336         type_pair_traits<TE1, TE2>::is_safe_initializable;
00337 };
00338 
00339 
00341 template <typename T1, typename T2>
00342 struct type_pair_traits_for_builtin_numeric
00343 {
00344 private:
00345 
00346     typedef std::numeric_limits<T1> NL1;
00347     typedef std::numeric_limits<T2> NL2;
00348 
00349 public:
00350 
00351     static const bool is_specialized =
00352         NL1::is_specialized && NL2::is_specialized;
00353 
00354     static const bool is_convertible = true;
00355 
00356     static const bool is_safe_convertible =
00357         (!(NL1::is_signed && !NL2::is_signed)) &&
00358         (!(!NL1::is_integer && NL2::is_integer)) &&
00359         (NL1::digits <= NL2::digits || NL1::is_bounded && !NL1::is_bounded);
00360     
00361     static const bool is_assignable = is_convertible;
00362     static const bool is_safe_assignable = is_safe_convertible;
00363     static const bool is_initializable = is_convertible;
00364     static const bool is_safe_initializable = is_safe_convertible;
00365 };
00366 
00367 
00368 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00369 
00370 
00372 
00375 
00376 #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, T2)    \
00377 template <> struct type_pair_traits<T1, T2>                 \
00378     : public type_pair_traits_for_builtin_numeric<T1, T2> {};
00379 
00380 #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(T1)              \
00381     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, bool)                  \
00382     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, char)                  \
00383     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed char)           \
00384     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned char)         \
00385     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed short int)      \
00386     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned short int)    \
00387     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed int)            \
00388     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned int)          \
00389     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed long int)       \
00390     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned long int)     \
00391     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, float)                 \
00392     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, double)                \
00393     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, long double)
00394 
00395 #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_SECOND_STD_DEF(T2)             \
00396     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(bool, T2)                  \
00397     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(char, T2)                  \
00398     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(signed char, T2)           \
00399     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(unsigned char, T2)         \
00400     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(signed short int, T2)      \
00401     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(unsigned short int, T2)    \
00402     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(signed int, T2)            \
00403     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(unsigned int, T2)          \
00404     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(signed long int, T2)       \
00405     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(unsigned long int, T2)     \
00406     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(float, T2)                 \
00407     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(double, T2)                \
00408     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(long double, T2)
00409 
00410 #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STD_DEF                        \
00411     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(bool)                \
00412     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(char)                \
00413     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(signed char)         \
00414     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(unsigned char)       \
00415     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(signed short int)    \
00416     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(unsigned short int)  \
00417     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(signed int)          \
00418     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(unsigned int)        \
00419     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(signed long int)     \
00420     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(unsigned long int)   \
00421     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(float)               \
00422     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(double)              \
00423     ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(long double)
00424 
00425 #if defined(ARAGELI_INT64_SUPPORT) && defined(ARAGELI_LONG_LONG_SUPPORT)
00426 
00427     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(T1)        \
00428         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(T1)              \
00429         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_SECOND_STD_DEF(T1)             \
00430         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed __int64)    \
00431         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned __int64)  \
00432         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed long long)  \
00433         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned long long)
00434 
00435     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STDEX_DEF                      \
00436         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STD_DEF                            \
00437         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(signed __int64)    \
00438         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(unsigned __int64)  \
00439         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(signed long long)  \
00440         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(unsigned long long)
00441 
00442 #elif defined(ARAGELI_INT64_SUPPORT) && !defined(ARAGELI_LONG_LONG_SUPPORT)
00443 
00444     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(T1)        \
00445         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(T1)              \
00446         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_SECOND_STD_DEF(T1)             \
00447         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed __int64)    \
00448         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned __int64)
00449 
00450     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STDEX_DEF                      \
00451         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STD_DEF                            \
00452         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(signed __int64)    \
00453         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(unsigned __int64)
00454 
00455 #elif !defined(ARAGELI_INT64_SUPPORT) && defined(ARAGELI_LONG_LONG_SUPPORT)
00456 
00457     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(T1)        \
00458         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(T1)              \
00459         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_SECOND_STD_DEF(T1)             \
00460         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, signed long long)  \
00461         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_ONE_DEF(T1, unsigned long long)
00462 
00463     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STDEX_DEF                      \
00464         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STD_DEF                            \
00465         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(signed long long)  \
00466         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(unsigned long long)
00467 
00468 #elif !defined(ARAGELI_INT64_SUPPORT) && !defined(ARAGELI_LONG_LONG_SUPPORT)
00469 
00470     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STDEX_DEF(T1)    \
00471         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_FIRST_STD_DEF(T1)
00472 
00473     #define ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STDEX_DEF      \
00474         ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STD_DEF    
00475 
00476 #endif
00477 
00478 
00479 ARAGELI_TYPE_PAIR_TRAITS_BUILTIN_STDEX_DEF;
00480 
00482 
00483 
00484 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00485 
00486 
00488 template <typename T1, typename T2>
00489 struct type_pair_traits_for_unknown_and_aggregate
00490 {
00491 protected:
00492 
00493     typedef typename type_traits<T2>::element_type TE2;
00494 
00495 public:
00496 
00497     static const bool is_specialized =
00498         type_traits<T1>::is_specialized &&
00499         type_traits<T2>::is_specialized &&
00500         type_traits<T2>::is_aggregate &&
00501         type_traits<TE2>::is_specialized;
00502 
00503     static const bool is_convertible =
00504         type_pair_traits<T1, TE2>::is_convertible;
00505 
00506     static const bool is_safe_convertible =
00507         type_pair_traits<T1, TE2>::is_safe_convertible;
00508     
00509     static const bool is_assignable =
00510         type_pair_traits<T1, TE2>::is_assignable;
00511 
00512     static const bool is_safe_assignable =
00513         type_pair_traits<T1, TE2>::is_safe_assignable;
00514     
00515     static const bool is_initializable =
00516         type_pair_traits<T1, TE2>::is_initializable;
00517 
00518     static const bool is_safe_initializable =
00519         type_pair_traits<T1, TE2>::is_safe_initializable;
00520 };
00521 
00522 
00524 
00527 template <typename T1, typename T2>
00528 struct type_pair_traits_for_unknown_and_vector_matrix
00529     : public type_pair_traits_for_unknown_and_aggregate<T1, T2>
00530 {
00531     static const bool is_initializable = false;
00532     static const bool is_safe_initializable = false;
00533 };
00534 
00535 
00537 template <typename T1, typename T2>
00538 struct type_pair_traits_for_unknown_and_rational
00539     : public type_pair_traits_for_unknown_and_aggregate<T1, T2>
00540 {
00541 protected:
00542 
00543     typedef typename type_traits<T2>::element_type TE2;
00544 
00545 public:
00546 
00547     static const bool is_convertible =
00548         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_convertible &&
00549         type_traits<TE2>::has_unit;
00550 
00551     static const bool is_safe_convertible =
00552         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_safe_convertible &&
00553         type_traits<TE2>::has_unit;
00554     
00555     static const bool is_assignable =
00556         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_assignable &&
00557         type_traits<TE2>::has_unit;
00558 
00559     static const bool is_safe_assignable =
00560         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_safe_assignable &&
00561         type_traits<TE2>::has_unit;
00562     
00563     static const bool is_initializable =
00564         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_initializable &&
00565         type_traits<TE2>::has_unit;
00566 
00567     static const bool is_safe_initializable =
00568         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_safe_initializable &&
00569         type_traits<TE2>::has_unit;
00570 };
00571 
00572 
00574 template <typename T1, typename T2>
00575 struct type_pair_traits_for_rational_and_unknown
00576     : public type_pair_traits_for_aggregate_and_unknown<T1, T2>
00577 {
00578     static const bool is_specialized =
00579         type_traits<T1>::is_specialized &&
00580         type_traits<T2>::is_specialized;
00581 
00582     static const bool is_convertible =
00583         type_pair_traits<T1, T2>::is_convertible;
00584 
00585     static const bool is_safe_convertible =
00586         type_traits<T2>::is_rational &&
00587         type_traits<T2>::is_aggregate &&
00588         type_pair_traits<TE1, typename type_traits<T2>::element_type>::is_specialized &&
00589         type_pair_traits<TE1, typename type_traits<T2>::element_type>::is_safe_convertible;
00590     
00591     static const bool is_assignable = is_convertible;
00592     static const bool is_safe_assignable = is_safe_convertible;
00593     static const bool is_initializable = is_convertible;
00594     static const bool is_safe_initializable = is_safe_convertible;
00595 };
00596 
00597 
00598 
00600 template <typename T1, typename T2>
00601 struct type_pair_traits_for_unknown_and_polynom
00602     : public type_pair_traits_for_unknown_and_aggregate<T1, T2>
00603 {
00604 protected:
00605 
00606     typedef typename T2::degree_type TD2;
00607 
00608 public:
00609 
00610     static const bool is_convertible =
00611         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_convertible &&
00612         type_traits<TD2>::has_null;
00613 
00614     static const bool is_safe_convertible =
00615         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_safe_convertible &&
00616         type_traits<TD2>::has_null;
00617     
00618     static const bool is_assignable =
00619         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_assignable &&
00620         type_traits<TD2>::has_null;
00621 
00622     static const bool is_safe_assignable =
00623         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_safe_assignable &&
00624         type_traits<TD2>::has_null;
00625     
00626     static const bool is_initializable =
00627         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_initializable &&
00628         type_traits<TD2>::has_null;
00629 
00630     static const bool is_safe_initializable =
00631         type_pair_traits_for_unknown_and_aggregate<T1, T2>::is_safe_initializable &&
00632         type_traits<TD2>::has_null;
00633 };
00634 
00635 #endif
00636 
00637 
00638 } // namespace Arageli
00639 
00640 
00641 
00642 //#ifdef ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE
00643 //  #define ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE_TYPE_PAIR_TRAITS
00644 //  #include "type_pair_traits.cpp"
00645 //  #undef  ARAGELI_INCLUDE_CPP_WITH_EXPORT_TEMPLATE_TYPE_PAIR_TRAITS
00646 //#endif
00647 
00648 
00649 #endif  //  #ifndef _ARAGELI_type_pair_traits_hpp_

Generated on Thu Aug 31 17:38:12 2006 for Arageli by  doxygen 1.4.7