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

Already on GitHub? Sign in to your account

name conflict in Data::Keywords::bind #82

Closed
adrianimboden opened this Issue Feb 10, 2013 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

adrianimboden commented Feb 10, 2013

There is a name conflict between std::bind and Poco::Data:Keywords::bind when using c++11 in gcc.

Code:
Poco::Data::Session session(...);
session << "somesql ?", bind(std::string("Text"));

Error:
error: cannot convert 'std::Bind_helper<false, std::basic_string&, const char (&)[1]>::type {aka std::Bindstd::basic_string<char(const char)>}' to 'Poco::Data::CopyBindingstd::basic_string' in return

Owner

aleks-f commented Feb 11, 2013

I'll look into it. In the meantime, see if

using Poco::Data::Keywords::bind;

helps.

@ghost ghost assigned aleks-f Feb 11, 2013

Contributor

adrianimboden commented Feb 11, 2013

When using "using Poco::Data::Keywords::bind", calling
"bind(std::string("Text"), "");" works, but "bind(std::string("Text"));" does not, because the overload with one parameter calls the overload with two parameters, but Poco itself does not have a definition like "using Poco::Data::Keywords::bind;".

A workaround would be to call bind like this:
Poco::Data::Keywords::bind(std::string("Text"), "");
An explicit call to the second overload is necessary.

Owner

aleks-f commented Feb 12, 2013

The joys of ADL >:-(

See if this does the trick (Binding.h):

template <typename T> 
inline CopyBinding<T>* bind(T t)
    /// Convenience function for a more compact Binding creation.
    /// This funtion differs from use() in its value copy semantics.
{
    using Poco::Data::Keywords::bind; // add this
    return bind(t, "");
}

@aleks-f aleks-f added a commit that referenced this issue Apr 28, 2013

@aleks-f aleks-f data housekeeping
- removed naked pointers from Data interfaces
- fixed GH #82: name conflict in Data::Keywords::bind
- fixed GH #157: MySQL: cannot bind to 'long' data type on
Windows/Visual C++
- fixed GH #158: MySQL: MYSQL_BIND 'is_unsigned' member is not set
a50823c

@aleks-f aleks-f closed this Apr 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment