mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
最初
This commit is contained in:
commit
b3bb8121e8
362 changed files with 16820 additions and 0 deletions
45
sprout/fixed_container/begin.hpp
Normal file
45
sprout/fixed_container/begin.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_BEGIN_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_BEGIN_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// begin
|
||||
//
|
||||
template<typename Range>
|
||||
typename sprout::fixed_container_traits<Range>::iterator begin(Range& range) {
|
||||
return range.begin();
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
typename sprout::fixed_container_traits<T const[N]>::iterator begin(T (& arr)[N]) {
|
||||
return arr;
|
||||
}
|
||||
//
|
||||
// begin
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::const_iterator begin(Range const& range) {
|
||||
return range.begin();
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<T const[N]>::const_iterator begin(T const (& arr)[N]) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
//
|
||||
// cbegin
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::const_iterator cbegin(Range const& range) {
|
||||
return range.begin();
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<T const[N]>::const_iterator cbegin(T const (& arr)[N]) {
|
||||
return arr;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_BEGIN_HPP
|
18
sprout/fixed_container/const_iterator.hpp
Normal file
18
sprout/fixed_container/const_iterator.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_CONST_ITERATOR_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_CONST_ITERATOR_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_const_iterator
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_const_iterator {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::const_iterator type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_CONST_ITERATOR_HPP
|
18
sprout/fixed_container/const_pointer.hpp
Normal file
18
sprout/fixed_container/const_pointer.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_CONST_POINTER_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_CONST_POINTER_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_const_pointer
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_const_pointer {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::const_pointer type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_CONST_POINTER_HPP
|
18
sprout/fixed_container/const_reference.hpp
Normal file
18
sprout/fixed_container/const_reference.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_CONST_REFERENCE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_CONST_REFERENCE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_const_reference
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_const_reference {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::const_reference type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_CONST_REFERENCE_HPP
|
18
sprout/fixed_container/difference_type.hpp
Normal file
18
sprout/fixed_container/difference_type.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_DIFFERENCE_TYPE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_DIFFERENCE_TYPE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_difference_type
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_difference_type {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::difference_type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_DIFFERENCE_TYPE_HPP
|
18
sprout/fixed_container/empty.hpp
Normal file
18
sprout/fixed_container/empty.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_EMPTY_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_EMPTY_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/size.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// empty
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR bool empty(Range const& range) {
|
||||
return sprout::size(range) == 0;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_EMPTY_HPP
|
45
sprout/fixed_container/end.hpp
Normal file
45
sprout/fixed_container/end.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_END_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_END_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// end
|
||||
//
|
||||
template<typename Range>
|
||||
typename sprout::fixed_container_traits<Range>::iterator end(Range& range) {
|
||||
return range.end();
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
typename sprout::fixed_container_traits<T const[N]>::iterator end(T (& arr)[N]) {
|
||||
return arr + N;
|
||||
}
|
||||
//
|
||||
// end
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::const_iterator end(Range const& range) {
|
||||
return range.end();
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<T const[N]>::const_iterator end(T const (& arr)[N]) {
|
||||
return arr + N;
|
||||
}
|
||||
|
||||
//
|
||||
// cend
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::const_iterator cend(Range const& range) {
|
||||
return range.end();
|
||||
}
|
||||
template<typename T, std::size_t N>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<T const[N]>::const_iterator cend(T const (& arr)[N]) {
|
||||
return arr + N;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_END_HPP
|
37
sprout/fixed_container/fixed_begin.hpp
Normal file
37
sprout/fixed_container/fixed_begin.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIXED_BEGIN_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIXED_BEGIN_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/begin.hpp>
|
||||
#include <sprout/fixed_container/get_fixed.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_begin
|
||||
//
|
||||
template<typename Range>
|
||||
typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed_container_traits<Range>::fixed_container_type
|
||||
>::iterator fixed_begin(Range& range) {
|
||||
return sprout::begin(sprout::get_fixed(range));
|
||||
}
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed_container_traits<Range>::fixed_container_type
|
||||
>::const_iterator fixed_begin(Range const& range) {
|
||||
return sprout::begin(sprout::get_fixed(range));
|
||||
}
|
||||
|
||||
//
|
||||
// fixed_cbegin
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed_container_traits<Range>::fixed_container_type
|
||||
>::const_iterator fixed_cbegin(Range const& range) {
|
||||
return sprout::begin(sprout::get_fixed(range));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIXED_BEGIN_HPP
|
20
sprout/fixed_container/fixed_begin_offset.hpp
Normal file
20
sprout/fixed_container/fixed_begin_offset.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIXED_BEGIN_OFFSET_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIXED_BEGIN_OFFSET_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/begin.hpp>
|
||||
#include <sprout/fixed_container/fixed_begin.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_begin_offset
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::difference_type fixed_begin_offset(Range const& range) {
|
||||
return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(range), sprout::begin(range));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIXED_BEGIN_OFFSET_HPP
|
18
sprout/fixed_container/fixed_container_type.hpp
Normal file
18
sprout/fixed_container/fixed_container_type.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIXED_CONTAINER_TYPE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIXED_CONTAINER_TYPE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_container_type
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_container_type {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::fixed_container_type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIXED_CONTAINER_TYPE_HPP
|
37
sprout/fixed_container/fixed_end.hpp
Normal file
37
sprout/fixed_container/fixed_end.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIXED_END_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIXED_END_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/end.hpp>
|
||||
#include <sprout/fixed_container/get_fixed.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_end
|
||||
//
|
||||
template<typename Range>
|
||||
typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed_container_traits<Range>::fixed_container_type
|
||||
>::iterator fixed_end(Range& range) {
|
||||
return sprout::end(sprout::get_fixed(range));
|
||||
}
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed_container_traits<Range>::fixed_container_type
|
||||
>::const_iterator fixed_end(Range const& range) {
|
||||
return sprout::end(sprout::get_fixed(range));
|
||||
}
|
||||
|
||||
//
|
||||
// fixed_cend
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<
|
||||
typename sprout::fixed_container_traits<Range>::fixed_container_type
|
||||
>::const_iterator fixed_cend(Range const& range) {
|
||||
return sprout::end(sprout::get_fixed(range));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIXED_END_HPP
|
20
sprout/fixed_container/fixed_end_offset.hpp
Normal file
20
sprout/fixed_container/fixed_end_offset.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIXED_END_OFFSET_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIXED_END_OFFSET_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/end.hpp>
|
||||
#include <sprout/fixed_container/fixed_begin.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_end_offset
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::difference_type fixed_end_offset(Range const& range) {
|
||||
return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::fixed_begin(range), sprout::end(range));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIXED_END_OFFSET_HPP
|
22
sprout/fixed_container/fixed_size.hpp
Normal file
22
sprout/fixed_container/fixed_size.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FIXED_SIZE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FIXED_SIZE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_size
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_size {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::size_type value
|
||||
= sprout::fixed_container_traits<Container>::fixed_size
|
||||
;
|
||||
typedef std::integral_constant<typename sprout::fixed_container_traits<Container>::size_type, value> type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FIXED_SIZE_HPP
|
15
sprout/fixed_container/functions.hpp
Normal file
15
sprout/fixed_container/functions.hpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_FUNCTIONS_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_FUNCTIONS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/fixed_container/begin.hpp>
|
||||
#include <sprout/fixed_container/end.hpp>
|
||||
#include <sprout/fixed_container/size.hpp>
|
||||
#include <sprout/fixed_container/empty.hpp>
|
||||
#include <sprout/fixed_container/get_fixed.hpp>
|
||||
#include <sprout/fixed_container/fixed_begin.hpp>
|
||||
#include <sprout/fixed_container/fixed_end.hpp>
|
||||
#include <sprout/fixed_container/fixed_begin_offset.hpp>
|
||||
#include <sprout/fixed_container/fixed_end_offset.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_FUNCTIONS_HPP
|
37
sprout/fixed_container/get_fixed.hpp
Normal file
37
sprout/fixed_container/get_fixed.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_GET_FIXED_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_GET_FIXED_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// get_fixed
|
||||
//
|
||||
template<typename Container>
|
||||
inline typename sprout::fixed_container_traits<Container>::fixed_container_type& get_fixed(Container& cont) {
|
||||
return get_fixed_functor<Container>()(cont);
|
||||
}
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type const& get_fixed(Container const& cont) {
|
||||
return get_fixed_functor<Container>()(cont);
|
||||
}
|
||||
|
||||
//
|
||||
// get_cfixed
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type const& get_cfixed(Container const& cont) {
|
||||
return get_fixed_functor<Container>()(cont);
|
||||
}
|
||||
|
||||
//
|
||||
// get_fixed_copy
|
||||
//
|
||||
template<typename Container>
|
||||
SPROUT_CONSTEXPR inline typename sprout::fixed_container_traits<Container>::fixed_container_type get_fixed_copy(Container const& cont) {
|
||||
return get_fixed_functor<Container>()(cont);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_GET_FIXED_HPP
|
24
sprout/fixed_container/iterator.hpp
Normal file
24
sprout/fixed_container/iterator.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_ITERATOR_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_ITERATOR_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/detail/if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_iterator
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_iterator {
|
||||
public:
|
||||
typedef typename sprout::detail::if_c<
|
||||
std::is_const<Container>::value,
|
||||
typename sprout::fixed_container_traits<Container>::const_iterator,
|
||||
typename sprout::fixed_container_traits<Container>::iterator
|
||||
>::type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_ITERATOR_HPP
|
21
sprout/fixed_container/metafunctions.hpp
Normal file
21
sprout/fixed_container/metafunctions.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_METAFUNCTIONS_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_METAFUNCTIONS_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/fixed_container_type.hpp>
|
||||
#include <sprout/fixed_container/fixed_size.hpp>
|
||||
#include <sprout/fixed_container/value_type.hpp>
|
||||
#include <sprout/fixed_container/mutable_iterator.hpp>
|
||||
#include <sprout/fixed_container/const_iterator.hpp>
|
||||
#include <sprout/fixed_container/iterator.hpp>
|
||||
#include <sprout/fixed_container/mutable_reference.hpp>
|
||||
#include <sprout/fixed_container/const_reference.hpp>
|
||||
#include <sprout/fixed_container/reference.hpp>
|
||||
#include <sprout/fixed_container/size_type.hpp>
|
||||
#include <sprout/fixed_container/difference_type.hpp>
|
||||
#include <sprout/fixed_container/mutable_pointer.hpp>
|
||||
#include <sprout/fixed_container/const_pointer.hpp>
|
||||
#include <sprout/fixed_container/pointer.hpp>
|
||||
#include <sprout/fixed_container/rebind_fixed_size_eval.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_METAFUNCTIONS_HPP
|
18
sprout/fixed_container/mutable_iterator.hpp
Normal file
18
sprout/fixed_container/mutable_iterator.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_MUTABLE_ITERATOR_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_MUTABLE_ITERATOR_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_mutable_iterator
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_mutable_iterator {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::iterator type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_MUTABLE_ITERATOR_HPP
|
18
sprout/fixed_container/mutable_pointer.hpp
Normal file
18
sprout/fixed_container/mutable_pointer.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_MUTABLE_POINTER_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_MUTABLE_POINTER_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_mutable_pointer
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_mutable_pointer {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::pointer type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_MUTABLE_POINTER_HPP
|
18
sprout/fixed_container/mutable_reference.hpp
Normal file
18
sprout/fixed_container/mutable_reference.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_MUTABLE_REFERENCE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_MUTABLE_REFERENCE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_mutable_reference
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_mutable_reference {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::reference type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_MUTABLE_REFERENCE_HPP
|
24
sprout/fixed_container/pointer.hpp
Normal file
24
sprout/fixed_container/pointer.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_POINTER_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_POINTER_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/detail/if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_pointer
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_pointer {
|
||||
public:
|
||||
typedef typename sprout::detail::if_c<
|
||||
std::is_const<Container>::value,
|
||||
typename sprout::fixed_container_traits<Container>::const_pointer,
|
||||
typename sprout::fixed_container_traits<Container>::pointer
|
||||
>::type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_POINTER_HPP
|
17
sprout/fixed_container/rebind_fixed_size_eval.hpp
Normal file
17
sprout/fixed_container/rebind_fixed_size_eval.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_REBIND_FIXED_SIZE_EVAL_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_REBIND_FIXED_SIZE_EVAL_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// rebind_fixed_size_eval
|
||||
//
|
||||
template<typename Container, typename sprout::fixed_container_traits<Container>::size_type S>
|
||||
struct rebind_fixed_size_eval
|
||||
: public rebind_fixed_size<Container>::template apply<S>
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_REBIND_FIXED_SIZE_EVAL_HPP
|
24
sprout/fixed_container/reference.hpp
Normal file
24
sprout/fixed_container/reference.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_REFERENCE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_REFERENCE_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/detail/if.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_reference
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_reference {
|
||||
public:
|
||||
typedef typename sprout::detail::if_c<
|
||||
std::is_const<Container>::value,
|
||||
typename sprout::fixed_container_traits<Container>::const_reference,
|
||||
typename sprout::fixed_container_traits<Container>::reference
|
||||
>::type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_REFERENCE_HPP
|
20
sprout/fixed_container/size.hpp
Normal file
20
sprout/fixed_container/size.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_SIZE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_SIZE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
#include <sprout/fixed_container/begin.hpp>
|
||||
#include <sprout/fixed_container/end.hpp>
|
||||
#include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// size
|
||||
//
|
||||
template<typename Range>
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Range>::difference_type size(Range const& range) {
|
||||
return NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance(sprout::begin(range), sprout::end(range));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_SIZE_HPP
|
18
sprout/fixed_container/size_type.hpp
Normal file
18
sprout/fixed_container/size_type.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_SIZE_TYPE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_SIZE_TYPE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_size_type
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_size_type {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::size_type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_SIZE_TYPE_HPP
|
97
sprout/fixed_container/traits.hpp
Normal file
97
sprout/fixed_container/traits.hpp
Normal file
|
@ -0,0 +1,97 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_TRAITS_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_TRAITS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <array>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace detail {
|
||||
template<typename Container>
|
||||
struct fixed_container_traits_base {
|
||||
public:
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename Container::iterator iterator;
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
typedef typename Container::reference reference;
|
||||
typedef typename Container::const_reference const_reference;
|
||||
typedef typename Container::size_type size_type;
|
||||
typedef typename Container::difference_type difference_type;
|
||||
typedef typename Container::pointer pointer;
|
||||
typedef typename Container::const_pointer const_pointer;
|
||||
};
|
||||
template<typename T, std::size_t N>
|
||||
struct fixed_container_traits_base<T[N]> {
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T* iterator;
|
||||
typedef T const* const_iterator;
|
||||
typedef T& reference;
|
||||
typedef T const& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T* pointer;
|
||||
typedef T const* const_pointer;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
// fixed_container_traits
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_container_traits
|
||||
: public sprout::detail::fixed_container_traits_base<Container>
|
||||
{
|
||||
public:
|
||||
typedef Container fixed_container_type;
|
||||
public:
|
||||
static constexpr typename sprout::detail::fixed_container_traits_base<Container>::size_type fixed_size
|
||||
= std::tuple_size<typename std::remove_const<fixed_container_type>::type>::value
|
||||
;
|
||||
};
|
||||
template<typename T, std::size_t N>
|
||||
struct fixed_container_traits<T[N]>
|
||||
: public sprout::detail::fixed_container_traits_base<T[N]>
|
||||
{
|
||||
public:
|
||||
typedef T fixed_container_type[N];
|
||||
public:
|
||||
static constexpr typename sprout::detail::fixed_container_traits_base<T[N]>::size_type fixed_size = N;
|
||||
};
|
||||
|
||||
//
|
||||
// rebind_fixed_size
|
||||
//
|
||||
template<typename Container>
|
||||
struct rebind_fixed_size {
|
||||
public:
|
||||
template<typename sprout::fixed_container_traits<Container>::size_type S>
|
||||
struct apply;
|
||||
};
|
||||
template<typename T, std::size_t N>
|
||||
struct rebind_fixed_size<T[N]> {
|
||||
public:
|
||||
template<typename sprout::fixed_container_traits<T[N]>::size_type S>
|
||||
struct apply {
|
||||
public:
|
||||
typedef T type[S];
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// get_fixed_functor
|
||||
//
|
||||
template<typename Container>
|
||||
struct get_fixed_functor {
|
||||
public:
|
||||
typename sprout::fixed_container_traits<Container>::fixed_container_type& operator()(Container& cont) const {
|
||||
return cont;
|
||||
}
|
||||
SPROUT_CONSTEXPR typename sprout::fixed_container_traits<Container>::fixed_container_type const& operator()(Container const& cont) const {
|
||||
return cont;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_TRAITS_HPP
|
18
sprout/fixed_container/value_type.hpp
Normal file
18
sprout/fixed_container/value_type.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_FIXED_CONTAINER_VALUE_TYPE_HPP
|
||||
#define SPROUT_FIXED_CONTAINER_VALUE_TYPE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/fixed_container/traits.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// fixed_value_type
|
||||
//
|
||||
template<typename Container>
|
||||
struct fixed_value_type {
|
||||
public:
|
||||
typedef typename sprout::fixed_container_traits<Container>::value_type type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_FIXED_CONTAINER_VALUE_TYPE_HPP
|
Loading…
Add table
Add a link
Reference in a new issue