public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Suresh Lakshmanan" <suresh_lakshmana@hotmail.com>
To: gcc-help@gcc.gnu.org
Cc: vonloesch@gmail.com
Subject: RE: Problem with implicit conversion (GCC 3.4.1)
Date: Thu, 26 Aug 2004 19:54:00 -0000	[thread overview]
Message-ID: <BAY1-F23F1yBgD2nfTX0001cafe@hotmail.com> (raw)

Try the code below. You could use std::min template in STL, so that you can 
force conversion
to the template parameter.

template<class T> class BasisF {
	T x;
public:

	BasisF(const T &_x = T()): x(_x) {}
	BasisF(const BasisF &_b): x(_b.x) {}
	~BasisF() {}

	BasisF& operator= (const T &_x){
		 x(_x);
		 return *this;
	}

	friend bool operator<=(const BasisF &a, const BasisF &b) {
		return a.x <= b.x;
	}
};

#define min(a,b) ((a) <= (b) ? (a) : (b))

int main(){
	BasisF<double> t(1);
	if (min(t, 2.0)<= 0) {
		return 1;
	}

	return 0;
}

Thanks,
L.Suresh.

_________________________________________________________________
Sell what you donÂ’t Need.We help you Ship it out. 
http://go.msnserver.com/IN/54179.asp Click Here!

             reply	other threads:[~2004-08-26 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-26 19:54 Suresh Lakshmanan [this message]
2004-08-26 22:17 ` Boris von Loesch
  -- strict thread matches above, loose matches on Subject: below --
2004-08-26 17:46 lrtaylor
2004-08-26 14:16 Boris von Loesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY1-F23F1yBgD2nfTX0001cafe@hotmail.com \
    --to=suresh_lakshmana@hotmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=vonloesch@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).