|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71623 - in sandbox/coerce: boost boost/coerce libs/coerce/test
From: vexocide_at_[hidden]
Date: 2011-04-30 10:37:10
Author: vexocide
Date: 2011-04-30 10:37:09 EDT (Sat, 30 Apr 2011)
New Revision: 71623
URL: http://svn.boost.org/trac/boost/changeset/71623
Log:
Miscellaneous changes, cleaned up reserve
Text files modified:
sandbox/coerce/boost/coerce.hpp | 18 +++++++++---------
sandbox/coerce/boost/coerce/container.hpp | 20 ++++++++------------
sandbox/coerce/boost/coerce/reserve.hpp | 19 ++++++-------------
sandbox/coerce/libs/coerce/test/reserve.cpp | 5 -----
4 files changed, 23 insertions(+), 39 deletions(-)
Modified: sandbox/coerce/boost/coerce.hpp
==============================================================================
--- sandbox/coerce/boost/coerce.hpp (original)
+++ sandbox/coerce/boost/coerce.hpp 2011-04-30 10:37:09 EDT (Sat, 30 Apr 2011)
@@ -51,8 +51,8 @@
do_call(
Target & target,
Source const & source,
- mpl::true_ const,
- bool const
+ mpl::true_,
+ bool
) {
typedef traits::iterable<Source> iterable_type;
typedef typename iterable_type::const_iterator iterator_type;
@@ -80,8 +80,8 @@
do_call(
Target & target,
Source const & source,
- mpl::false_ const,
- mpl::true_ const
+ mpl::false_,
+ mpl::true_
) {
call_reserve(
target,
@@ -97,16 +97,16 @@
return result;
}
- static inline void
+ static inline bool
do_call(
Target & target,
Source const & source,
- mpl::false_ const,
- mpl::false_ const
+ mpl::false_,
+ mpl::false_
) {
- // TODO, implement a lexical_cast fallback
-
BOOST_STATIC_ASSERT(sizeof(Target) == 0);
+
+ return false;
}
};
Modified: sandbox/coerce/boost/coerce/container.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/container.hpp (original)
+++ sandbox/coerce/boost/coerce/container.hpp 2011-04-30 10:37:09 EDT (Sat, 30 Apr 2011)
@@ -7,10 +7,8 @@
#ifndef BOOST_COERCE_CONTAINER_HPP
#define BOOST_COERCE_CONTAINER_HPP
-#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
#include <boost/mpl/has_xxx.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
namespace boost {
@@ -29,18 +27,16 @@
template <typename Type>
struct is_container_impl
- : mpl::bool_<
- detail::has_value_type<Type>::value &&
- detail::has_iterator<Type>::value &&
- detail::has_size_type<Type>::value &&
- detail::has_reference<Type>::value> { };
+ : mpl::and_<
+ detail::has_value_type<Type>,
+ detail::has_iterator<Type>,
+ detail::has_size_type<Type>,
+ detail::has_reference<Type>
+ > { };
template <typename Type, typename Enable = void>
struct is_container
- : is_container_impl<
- typename remove_const<
- typename remove_reference<Type>::type
- >::type> { };
+ : is_container_impl<Type> { };
} // namespace traits
Modified: sandbox/coerce/boost/coerce/reserve.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/reserve.hpp (original)
+++ sandbox/coerce/boost/coerce/reserve.hpp 2011-04-30 10:37:09 EDT (Sat, 30 Apr 2011)
@@ -10,15 +10,11 @@
#include <boost/config.hpp>
#include <boost/limits.hpp>
+#include <boost/mpl/bool.hpp>
#include <boost/optional.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/detail/yes_no_type.hpp>
-#include <cstddef>
-
-#ifndef BOOST_COERCE_UNSPECIALIZED_RESERVE
-#define BOOST_COERCE_UNSPECIALIZED_RESERVE 16
-#endif // BOOST_COERCE_UNSPECIALIZED_RESERVE
+#include <cstddef> // std::size_t
namespace boost {
@@ -29,7 +25,7 @@
template <typename Type>
struct reserve_size_impl {
BOOST_STATIC_CONSTANT(std::size_t, value =
- BOOST_COERCE_UNSPECIALIZED_RESERVE);
+ 3 * sizeof(Type) + 1);
};
template <>
@@ -120,11 +116,8 @@
typedef std::size_t type;
static inline type
- call(typename remove_reference<Type>::type const &) {
- return reserve_size_impl<
- typename remove_const<
- typename remove_reference<Type>::type
- >::type>::value;
+ call(Type const &) {
+ return reserve_size_impl<Type>::value;
}
};
Modified: sandbox/coerce/libs/coerce/test/reserve.cpp
==============================================================================
--- sandbox/coerce/libs/coerce/test/reserve.cpp (original)
+++ sandbox/coerce/libs/coerce/test/reserve.cpp 2011-04-30 10:37:09 EDT (Sat, 30 Apr 2011)
@@ -4,7 +4,6 @@
// (See accompanying file ../../../LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#define BOOST_COERCE_UNSPECIALIZED_RESERVE 0
#define BOOST_TEST_MODULE reserve
#include <boost/coerce.hpp>
@@ -33,10 +32,6 @@
BOOST_CHECK_GT(reserve_size<long double>::call(0.0l), 0u);
BOOST_CHECK_GT(reserve_size<bool>::call(false), 0u);
- BOOST_CHECK_GT(reserve_size<char const>::call('\0'), 0u);
- BOOST_CHECK_GT(reserve_size<char &>::call('\0'), 0u);
- BOOST_CHECK_GT(reserve_size<char const &>::call('\0'), 0u);
-
BOOST_CHECK_GT(reserve_size<boost::optional<char> >::call(
boost::optional<char>('\0')), 0u);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk