auto_config.hpp 追加

This commit is contained in:
bolero-MURAKAMI 2011-10-08 15:10:23 +09:00
parent 3c301adae8
commit e4c1e4ba7a
4 changed files with 56 additions and 9 deletions

View file

@ -12,7 +12,7 @@
#include <sprout/fixed_container/functions.hpp>
#include <sprout/iterator.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
# include <sprout/iterator/index_iterator.hpp>
#endif
@ -24,7 +24,7 @@ namespace sprout {
class array {
public:
typedef T value_type;
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
typedef sprout::index_iterator<array&> iterator;
typedef sprout::index_iterator<array const&> const_iterator;
#else
@ -59,7 +59,7 @@ namespace sprout {
throw std::out_of_range("array<>: index out of range");
}
}
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
iterator begin() SPROUT_NOEXCEPT {
return iterator(*this, 0);
}

41
sprout/auto_config.hpp Normal file
View file

@ -0,0 +1,41 @@
#ifndef SPROUT_AUTO_CONFIG_HPP
#define SPROUT_AUTO_CONFIG_HPP
#include <boost/config.hpp>
//
// SPROUT_CONFIG_DISABLE_CONSTEXPR
//
#ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR
# ifdef BOOST_NO_CONSTEXPR
# if !defined(__GNUC__) \
|| defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__))
# define SPROUT_CONFIG_DISABLE_CONSTEXPR
# endif
# endif // #ifdef BOOST_NO_CONSTEXPR
#endif // #ifndef SPROUT_CONFIG_DISABLE_CONSTEXPR
//
// SPROUT_CONFIG_DISABLE_NOEXCEPT
//
#ifndef SPROUT_CONFIG_DISABLE_NOEXCEPT
# ifdef BOOST_NO_NOEXCEPT
# if !defined(__GNUC__) \
|| defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__))
# define SPROUT_CONFIG_DISABLE_NOEXCEPT
# endif
# endif // #ifdef BOOST_NO_NOEXCEPT
#endif // #ifndef SPROUT_CONFIG_DISABLE_NOEXCEPT
//
// SPROUT_CONFIG_USE_SSCRISK_CEL
//
//
// SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
//
#ifndef SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
# define SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
#endif // #ifndef SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
#endif // #ifndef SPROUT_AUTO_CONFIG_HPP

View file

@ -29,4 +29,10 @@
# define NS_SSCRISK_CEL_OR_SPROUT_DETAIL sscrisk::cel
#endif // #ifndef SPROUT_CONFIG_USE_SSCRISK_CEL
#ifndef SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
# define SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION 0
#else // #ifndef SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
# define SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION 1
#endif // #ifndef SPROUT_CONFIG_SUPPORT_TEMPORARY_CONTAINER_ITERATION
#endif // #ifndef SPROUT_CONFIG_HPP

View file

@ -17,7 +17,7 @@
#include <sprout/operation/fixed/append_front.hpp>
#include <sprout/iterator.hpp>
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
# include <algorithm>
# include <sprout/iterator/index_iterator.hpp>
#endif
@ -88,7 +88,7 @@ namespace sprout {
static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT {
return impl_type::eof();
}
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
template<typename CharIterator>
static SPROUT_CONSTEXPR int compare(CharIterator s1, CharIterator s2, std::size_t n) {
return !n ? 0
@ -135,7 +135,7 @@ namespace sprout {
class basic_string {
public:
typedef T value_type;
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
typedef sprout::index_iterator<basic_string&> iterator;
typedef sprout::index_iterator<basic_string const&> const_iterator;
#else
@ -179,7 +179,7 @@ namespace sprout {
{
return sprout::basic_string<T, N, Traits>{{(Indexes < n ? s[Indexes] : T())...}, n};
}
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
static SPROUT_CONSTEXPR int compare_impl_1(const_iterator dest, size_type pos1, size_type n1, const_iterator s, size_type n2) {
return compare_impl_2(
traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT_DETAIL::min(n1, n2)),
@ -224,7 +224,7 @@ namespace sprout {
throw std::out_of_range("basic_string<>: index out of range");
}
}
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
iterator begin() SPROUT_NOEXCEPT {
return iterator(*this, 0);
}
@ -430,7 +430,7 @@ namespace sprout {
: throw "basic_string<>: index out of range"
;
}
#ifdef SPROUT_CONFIG_USE_INDEX_ITERATOR_IMPLEMENTATION
#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION
basic_string<T, N, Traits>& assign(const_iterator s, size_type n) {
maxcheck(n);
for (size_type i = 0; i < n; ++i) {