List:MySQL++« Previous MessageNext Message »
From:Chris Frey Date:September 18 2005 5:51pm
Subject:Re: [patch] row::operator[] - template version
View as plain text  
On Sun, Sep 18, 2005 at 12:30:49PM -0400, pps wrote:
> >I'd be interested in what kind of errors the above patch could cause.
> 
> I don't remember, but I really had to redo it :)
> 
> >I suppose the template/non-template could confuse some compilers.  If so,
> >we could get rid of non-template members completely, and make a 
> >specialization
> >for the const char * version.  That should work.
> 
> The problem is that there's no such thing as partial template 
> specialization for members. If you have two templates with the same 
> signature, there's good chance a wrong template gets selected (resulting 
> in compile error or worse, wrong code being executed). For control of 
> instantiation of templates SFINAE (substitution-failure-is-not-an-error) 
> principle used. enable_if exploits this thing.

Thanks for the detailed email.  I had to read up on this to fully
understand it.  Google's cache came in handy, as the most informative
site didn't respond: http://tinyurl.com/cemw6

But as you noted elsewhere in your email, we are not using this in a
templated class, so the only problem is that the template may match
more types than it should, for the integer case.

The good news is that the integer template case just calls row::at(),
which only has an integer argument.  If I understand SFINAE correctly,
if the integer doesn't fit with at(), the template won't be considered.
It will fail with non-integer arguments in any case, which is fine. :-)

I don't know off hand, without testing, which style will produce the
clearest error messages for the user.


> >Could you run a test compile and let us know, on WinXP?
> 
> I don't know how to compile it !!! :)
> I'll look around for the patch on the list to be able to compile it, or 
> I'll create my own project files from zero...

The development site is: https://gna.org/projects/mysqlpp/
You can grab the latest makemake.bat file here:
	http://svn.gna.org/viewcvs/mysqlpp/trunk/

- Chris

Thread
[patch] row::operator[] - template versionChris Frey18 Sep
  • Re: [patch] row::operator[] - template versionWarren Young19 Sep
    • Re: [patch] row::operator[] - template versionWarren Young19 Sep
      • Re: [patch] row::operator[] - template versionChris Frey19 Sep
        • Re: [patch] row::operator[] - template versionWarren Young19 Sep
          • Re: [patch] row::operator[] - template versionChris Frey19 Sep
Re: [patch] row::operator[] - template versionChris Frey18 Sep
  • Re: [patch] row::operator[] - template versionUnknown Sender18 Sep
    • Re: [patch] row::operator[] - template versionChris Frey18 Sep
      • Re: [patch] row::operator[] - template versionUnknown Sender18 Sep
        • Re: [patch] row::operator[] - template versionWarren Young19 Sep
          • Re: [patch] row::operator[] - template versionUnknown Sender19 Sep
            • Re: [patch] row::operator[] - template versionWarren Young19 Sep
      • Re: [OBORONA-SPAM] Re: [patch] row::operator[] - template versionUnknown Sender19 Sep
        • Re: [OBORONA-SPAM] Re: [patch] row::operator[] - template versionChris Frey19 Sep
          • Re: [patch] row::operator[] - template versionUnknown Sender19 Sep
            • Re: [patch] row::operator[] - template versionChris Frey19 Sep
            • Re: [patch] row::operator[] - template versionWarren Young19 Sep
        • Re: [patch] row::operator[] - template versionWarren Young19 Sep
    • Re: [patch] row::operator[] - template versionChris Frey18 Sep
  • Re: [patch] row::operator[] - template versionWarren Young19 Sep