OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
3.8 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../rezound/gcc41-hacky.patch
  5. # Copyright (C) 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Well, this part is hacky, gcc41 does not seem to match against the provided
  17. std::vector<> specialization. After some trial 'n error I decided to take
  18. a shortpath and let the default work on any contrainer a-like type.
  19. --- rezound-0.12.2beta/src/misc/CNestedDataFile/anytype.h.vanilla 2006-03-05 23:45:44.856469500 +0100
  20. +++ rezound-0.12.2beta/src/misc/CNestedDataFile/anytype.h 2006-03-06 00:09:06.584072000 +0100
  21. @@ -60,7 +60,26 @@
  22. // or we could leave these unimplemented to get a linker error instead (that's what I have to do with gcc>=3.4
  23. // /* the reason I haven't made string_to_anytype return a reference is because currently, it's probably not a big deal for most types.. and with string, we'd be making a copy into the ret parameter if I implemented it that way anyway.. perhaps I could remove the return type all together and always use the ret parameter to get back the data */
  24. template<typename Type> static const Type string_to_anytype(const string &str,Type &ret) ;// { no_specialization_of_this_template_with_the_given_type; }
  25. -template<typename Type> static const string anytype_to_string(const Type &any) ;// { no_specialization_of_this_template_with_the_given_type; }
  26. +
  27. +template<typename Type> static const string anytype_to_string(const Type &any)
  28. +/*
  29. +// I really wished that I didn't have to explicitly use 'vector' in the definition, I'd have like to use any container with an iterator interface
  30. +template<class Type> __attribute__((always_inline)) inline const string anytype_to_string(const vector<Type> &any) */
  31. +{
  32. + string s;
  33. + size_t l=any.size();
  34. + s="{";
  35. + for(size_t t=0;t<l;t++)
  36. + {
  37. + // leaving type in case it's not able to deduce aruments and chooses the default template implemenation
  38. + // if I knew how to constrain the original definition of the template, I would make it fully constrained
  39. + s+=anytype_to_string(any[t]);
  40. + if(t!=(l-1))
  41. + s+=",";
  42. + }
  43. + return s+"}";
  44. +}
  45. +
  46. @@ -146,24 +165,6 @@
  47. template<> static const string anytype_to_string<long double>(const long double &any) { if(isnan(any)) return "0"; else { ostringstream ss; if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
  48. -// I really wished that I didn't have to explicitly use 'vector' in the definition, I'd have like to use any container with an iterator interface
  49. -template<class Type> static const string anytype_to_string(const vector<Type> &any)
  50. -{
  51. - string s;
  52. - size_t l=any.size();
  53. - s="{";
  54. - for(size_t t=0;t<l;t++)
  55. - {
  56. - // leaving type in case it's not able to deduce aruments and chooses the default template implemenation
  57. - // if I knew how to constrain the original definition of the template, I would make it fully constrained
  58. - s+=anytype_to_string(any[t]);
  59. - if(t!=(l-1))
  60. - s+=",";
  61. - }
  62. - return s+"}";
  63. -}
  64. -
  65. -
  66. // ----------------------------------------------------------------------------
  67. namespace s2at // s2at signifies string_to_anytype/anytype_to_string