<br><br><div class="gmail_quote">On Sun, Nov 16, 2008 at 1:24 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div><div></div><div class="Wj3C7c"><br><div><div>On Nov 15, 2008, at 8:27 PM, Zhongxing Xu wrote:</div><br><blockquote type="cite"><br><br><div class="gmail_quote">On Sun, Nov 16, 2008 at 11:28 AM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div><br> On Nov 15, 2008, at 5:55 AM, Zhongxing Xu wrote:<br> <br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 <br> One side problem is that I cannot make the MemRegion* in the ImmutableList const. If I did that, I would get compile error, related to FoldingSet Profile() overloading.<br> <br> It seems that ImmutableList cannot take a const type as template parameter, otherwise the  two Profile functions in the partial specialization of FoldingSetTrait would have the same signature. (FoldingSet.h:444, 447).<br>
 </blockquote> <br></div> Could we provide a partial specialization of FoldingSetTrait just for ImmutableList?  Or, does (something like) this work (i.e., add another partial specialization for const types):<br> <br> template<typename const T> struct FoldingSetTrait<const T*> {<br>
  static inline void Profile(const T* X, FoldingSetNodeID& ID) {<br>    ID.AddPointer(X);<br>  }<br> };<br> </blockquote></div><br>Yeah, this works! Thanks. Incidentally, do you think the old problem is caused by a g++ bug, because, at FoldingSet.h:234, the parameter for Add() already contains 'const', T should not contain 'const' when being instantiated.<br>
</blockquote></div><br></div></div><div>On 234 we have:</div><div><br></div><div><div>  template <typename T></div> <div>  inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); }</div><div><br>
</div><div>maybe we just add partial specialization:</div><div><br></div><div><div>  template <typename const T></div> <div>  inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); }</div></div>
</div></div></blockquote><div> </div></div>This is not compilable. We cannot have 'const' in template parameter.<br>