Fixed constness detection of const char[] arrays

This commit is contained in:
Peter Schojer 2008-05-14 06:00:40 +00:00
parent 96c57718c4
commit 4e730ecc7e
2 changed files with 15 additions and 2 deletions

View File

@ -1388,14 +1388,14 @@ template <typename T>
inline Binding<T>* in(T& t, const std::string& name = "")
/// Convenience function for a more compact Binding creation.
{
return new Binding<T>(t, name, AbstractBinding::PD_IN);
return use(t, name);
}
inline Binding<NullData>* in(const NullData& t, const std::string& name = "")
/// NullData overload.
{
return new Binding<NullData>(const_cast<NullData&>(t), name, AbstractBinding::PD_IN);
return use(t, name);
}
@ -1403,6 +1403,7 @@ template <typename T>
inline Binding<T>* out(T& t)
/// Convenience function for a more compact Binding creation.
{
poco_static_assert (!IsConst<T>::VALUE);
return new Binding<T>(t, "", AbstractBinding::PD_OUT);
}
@ -1411,6 +1412,7 @@ template <typename T>
inline Binding<T>* io(T& t)
/// Convenience function for a more compact Binding creation.
{
poco_static_assert (!IsConst<T>::VALUE);
return new Binding<T>(t, "", AbstractBinding::PD_IN_OUT);
}

View File

@ -109,6 +109,17 @@ struct IsConst<const T>
};
template <typename T, int i>
struct IsConst<const T[i]>
/// Specialization for const char arrays
{
enum
{
VALUE = 1
};
};
template <typename T>
struct TypeWrapper
/// Use the type wrapper if you want to dedecouple constness and references from template types