[Libreoffice-commits] core.git: include/o3tl
Stephan Bergmann
sbergman at redhat.com
Fri Jun 10 10:58:31 UTC 2016
include/o3tl/any.hxx | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
New commits:
commit a411e3c9a3058bf1432782deeac1daa9a8d18910
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jun 10 12:57:31 2016 +0200
Const correctness in o3tl/any.hxx
Change-Id: Ife6ce05430c99cd5452166c942320a3a301578ff
diff --git a/include/o3tl/any.hxx b/include/o3tl/any.hxx
index 023f468..7bbfae8 100644
--- a/include/o3tl/any.hxx
+++ b/include/o3tl/any.hxx
@@ -36,33 +36,37 @@ namespace detail {
struct Void {};
template<typename T> struct Optional { using type = T const *; };
-template<> struct Optional<void> { using type = boost::optional<Void>; };
-template<> struct Optional<bool> { using type = boost::optional<bool>; };
+template<> struct Optional<void> { using type = boost::optional<Void const>; };
+template<> struct Optional<bool> { using type = boost::optional<bool const>; };
template<> struct Optional<sal_Int8> {
- using type = boost::optional<sal_Int8>;
+ using type = boost::optional<sal_Int8 const>;
};
template<> struct Optional<sal_Int16> {
- using type = boost::optional<sal_Int16>;
+ using type = boost::optional<sal_Int16 const>;
};
template<> struct Optional<sal_uInt16> {
- using type = boost::optional<sal_uInt16>;
+ using type = boost::optional<sal_uInt16 const>;
};
template<> struct Optional<sal_Int32> {
- using type = boost::optional<sal_Int32>;
+ using type = boost::optional<sal_Int32 const>;
};
template<> struct Optional<sal_uInt32> {
- using type = boost::optional<sal_uInt32>;
+ using type = boost::optional<sal_uInt32 const>;
};
template<> struct Optional<sal_Int64> {
- using type = boost::optional<sal_Int64>;
+ using type = boost::optional<sal_Int64 const>;
};
template<> struct Optional<sal_uInt64> {
- using type = boost::optional<sal_uInt64>;
+ using type = boost::optional<sal_uInt64 const>;
+};
+template<> struct Optional<float> {
+ using type = boost::optional<float const>;
+};
+template<> struct Optional<double> {
+ using type = boost::optional<double const>;
};
-template<> struct Optional<float> { using type = boost::optional<float>; };
-template<> struct Optional<double> { using type = boost::optional<double>; };
template<typename T> struct Optional<css::uno::Reference<T>> {
- using type = boost::optional<css::uno::Reference<T>>;
+ using type = boost::optional<css::uno::Reference<T> const>;
};
template<> struct Optional<css::uno::Reference<css::uno::XInterface>> {
using type = css::uno::Reference<css::uno::XInterface> const *;
@@ -81,12 +85,12 @@ template<typename T> struct IsUnoSequenceType<cppu::UnoSequenceType<T>>:
std::true_type
{};
-template<typename T> inline boost::optional<T> tryGetConverted(
+template<typename T> inline boost::optional<T const> tryGetConverted(
css::uno::Any const & any)
{
T v;
return (any >>= v)
- ? boost::optional<T>(std::move(v)) : boost::optional<T>();
+ ? boost::optional<T const>(std::move(v)) : boost::optional<T const>();
}
}
@@ -139,8 +143,8 @@ template<> inline detail::Optional<void>::type tryGet<void>(
css::uno::Any const & any)
{
return any.hasValue()
- ? boost::optional<detail::Void>()
- : boost::optional<detail::Void>(detail::Void());
+ ? boost::optional<detail::Void const>()
+ : boost::optional<detail::Void const>(detail::Void());
}
template<> inline detail::Optional<bool>::type tryGet<bool>(
More information about the Libreoffice-commits
mailing list