From f2cf93b6887f7eabcb9972bfc0e4e3e08e15c121 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Mon, 2 Oct 2006 21:35:18 +0000 Subject: [PATCH] fix for borland [SVN r35450] --- include/boost/strong_typedef.hpp | 55 ++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/include/boost/strong_typedef.hpp b/include/boost/strong_typedef.hpp index e1f35167..74a1727d 100644 --- a/include/boost/strong_typedef.hpp +++ b/include/boost/strong_typedef.hpp @@ -22,24 +22,45 @@ // a new type. BOOST_STRONG_TYPEDEF(T, D) creates a new type named D // that operates as a type T. +#include #include -#define BOOST_STRONG_TYPEDEF(T, D) \ -struct D \ - : boost::totally_ordered1< D \ - , boost::totally_ordered2< D, T \ - > > \ -{ \ - T t; \ - explicit D(const T t_) : t(t_) {}; \ - D(){}; \ - D(const D & t_) : t(t_.t){} \ - D & operator=(const D & rhs) { t = rhs.t; return *this;} \ - D & operator=(const T & rhs) { t = rhs; return *this;} \ - operator const T & () const {return t; } \ - operator T & () { return t; } \ - bool operator==(const D & rhs) const { return t == rhs.t; } \ - bool operator<(const D & rhs) const { return t < rhs.t; } \ -}; +#if !defined(__BORLANDC__) + #define BOOST_STRONG_TYPEDEF(T, D) \ + struct D \ + : boost::totally_ordered1< D \ + , boost::totally_ordered2< D, T \ + > > \ + { \ + T t; \ + explicit D(const T t_) : t(t_) {}; \ + D(){}; \ + D(const D & t_) : t(t_.t){} \ + D & operator=(const D & rhs) { t = rhs.t; return *this;} \ + D & operator=(const T & rhs) { t = rhs; return *this;} \ + operator const T & () const {return t; } \ + operator T & () { return t; } \ + bool operator==(const D & rhs) const { return t == rhs.t; } \ + bool operator<(const D & rhs) const { return t < rhs.t; } \ + }; +#else + #define BOOST_STRONG_TYPEDEF(T, D) \ + struct D \ + : boost::totally_ordered1< D \ + , boost::totally_ordered2< D, T \ + > > \ + { \ + T t; \ + explicit D(const T t_) : t(t_) {}; \ + D(){}; \ + D(const D & t_) : t(t_.t){} \ + D & operator=(const D & rhs) { t = rhs.t; return *this;} \ + D & operator=(const T & rhs) { t = rhs; return *this;} \ + /*operator const T & () const {return t; }*/ \ + operator T & () { return t; } \ + bool operator==(const D & rhs) const { return t == rhs.t; } \ + bool operator<(const D & rhs) const { return t < rhs.t; } \ + }; +#endif // !defined(__BORLANDC) #endif // BOOST_STRONG_TYPEDEF_HPP