Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicit keyword usage #35

Closed
lexicalunit opened this issue Oct 13, 2017 · 1 comment
Closed

explicit keyword usage #35

lexicalunit opened this issue Oct 13, 2017 · 1 comment

Comments

@lexicalunit
Copy link
Contributor

From @DraconPern on November 4, 2013 2:30

I suggest removing 'explicit' from operator bool() const; in the .h file (ling 731, result::operator bool() const) so that at least the file will work on vs2012 where it's not supported. The affect on this on client code should be minimal.

FYI, looking at the bool() operator, I am not quite sure what it's functionality is. The implementation is a static_cast from a shared_ptr... Which basically says, return true if result is assigned.

Copied from original issue: lexicalunit/nanodbc#11

@lexicalunit
Copy link
Contributor Author

Explicit conversion operators are a brand new C++11 feature, see Stroustrup's FAQ: http://www.stroustrup.com/C++11FAQ.html#explicit-convertion

I guess VS2012 didn't support that particular feature. I would recommend only defining NANODBC_USE_CPP11 if you have a compiler which fully supports the C++11 standard. Nanodbc should work just fine on VS2012 without needing NANODBC_USE_CPP11 to be defined. If you are getting this error when NANODBC_USE_CPP11 isn't defined, then that definitely needs to be fixed.

The functionality this provides is a simple way to test if a nanodbc::result object is valid. For example:

nanodbc::result r;
...
if(!r)
    something_went_wrong();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant