From 90799499d8d17160ed1f4a0ed929597d17c27426 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 13 Oct 2007 12:50:01 +0000 Subject: [PATCH] Changed a constructor of tockArrayView in the C++CSP support header, so that retyping conversions are more distinct from same-type constructors --- tock_support_cppcsp.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tock_support_cppcsp.h b/tock_support_cppcsp.h index d30f93c..dbab9ee 100644 --- a/tock_support_cppcsp.h +++ b/tock_support_cppcsp.h @@ -241,23 +241,21 @@ public: { } - //Retyping: - // Removed for now because it is causing ambiguity problems with the standard constructor (to do with const-ness) - // and because I'm not actually sure if it is used (I think retyping uses the constructor below with tockArrayView) - /* + //The retyping constructors have their parameters in the other order to the same-type functions above, + //to avoid ambiguities between retyping and same types (especially when const is involved): + template - inline tockArrayView(U* _realArray,const std::pair< boost::array , unsigned >& _dims) + inline tockArrayView(const std::pair< boost::array , unsigned >& _dims,U* _realArray) : realArray(reinterpret_cast(_realArray)),dims(_dims.first),totalSubDim(_dims.second) { //Assume it's a single U item: correctDimsRetype(sizeof(U)); } - */ //Retyping, same number of dims: template - inline tockArrayView(const tockArrayView& tav,const std::pair< boost::array , unsigned >& _dims) + inline tockArrayView(const std::pair< boost::array , unsigned >& _dims,const tockArrayView& tav) : realArray(reinterpret_cast(tav.data())),dims(_dims.first),totalSubDim(_dims.second) { correctDimsRetype(tav.size() * sizeof(U));