#ifndef SPROUT_CONTAINER_CONTAINER_TRAITS_HPP #define SPROUT_CONTAINER_CONTAINER_TRAITS_HPP #include #include #include namespace sprout { // // container_traits // template struct container_traits; namespace detail { template struct container_traits_default_types { 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 struct container_traits_default_types { 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; }; template struct container_traits_default_size { public: SPROUT_STATIC_CONSTEXPR typename sprout::detail::container_traits_default_types::size_type static_size = std::tuple_size::value ; public: static SPROUT_CONSTEXPR typename sprout::detail::container_traits_default_types::size_type fixed_size() { return static_size; } }; template struct container_traits_default_size { public: SPROUT_STATIC_CONSTEXPR typename sprout::detail::container_traits_default_types::size_type static_size = N ; public: static SPROUT_CONSTEXPR typename sprout::detail::container_traits_default_types::size_type fixed_size() { return static_size; } }; } // namespace detail template struct container_traits : public sprout::detail::container_traits_default_types , public sprout::detail::container_traits_default_size {}; template struct container_traits : public sprout::container_traits { public: typedef typename sprout::container_traits::const_iterator iterator; typedef typename sprout::container_traits::const_reference reference; typedef typename sprout::container_traits::const_pointer pointer; }; template struct container_traits : public sprout::detail::container_traits_default_types , public sprout::detail::container_traits_default_size {}; template struct container_traits : public sprout::container_traits { public: typedef typename sprout::container_traits::const_iterator iterator; typedef typename sprout::container_traits::const_reference reference; typedef typename sprout::container_traits::const_pointer pointer; }; } // namespace sprout #endif // #ifndef SPROUT_CONTAINER_CONTAINER_TRAITS_HPP