From a447303946427f89914f4911fc8e9c3d7125c39c Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Sat, 13 Nov 2004 20:19:44 +0000 Subject: [PATCH] empty_sequence checkin [SVN r26201] --- include/boost/mpl/empty_sequence.hpp | 42 ++++++++++++++++++++++++++++ test/empty_sequence.cpp | 36 ++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 include/boost/mpl/empty_sequence.hpp create mode 100644 test/empty_sequence.cpp diff --git a/include/boost/mpl/empty_sequence.hpp b/include/boost/mpl/empty_sequence.hpp new file mode 100644 index 0000000..be4113b --- /dev/null +++ b/include/boost/mpl/empty_sequence.hpp @@ -0,0 +1,42 @@ + +#ifndef BOOST_MPL_EMPTY_SEQUENCE_HPP_INCLUDED +#define BOOST_MPL_EMPTY_SEQUENCE_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2004 +// Copyright Alexander Nasonov 2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include +#include + +namespace boost { namespace mpl { + +struct empty_sequence +{ + struct tag; + struct begin { typedef random_access_iterator_tag category; }; + typedef begin end; +}; + +template<> +struct size_impl +{ + template< typename Sequence > struct apply + : int_<0> + { + }; +}; + +}} + +#endif // #ifndef BOOST_MPL_EMPTY_SEQUENCE_HPP_INCLUDED diff --git a/test/empty_sequence.cpp b/test/empty_sequence.cpp new file mode 100644 index 0000000..7332a14 --- /dev/null +++ b/test/empty_sequence.cpp @@ -0,0 +1,36 @@ + +// Copyright Aleksey Gurtovoy 2004 +// Copyright Alexander Nasonov 2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include +#include +#include +#include +#include + +#include +#include + +MPL_TEST_CASE() +{ + typedef begin::type begin; + typedef end::type end; + + MPL_ASSERT(( is_same )); + MPL_ASSERT_RELATION( (mpl::distance::value), ==, 0 ); + MPL_ASSERT_RELATION( size::value, ==, 0 ); + + typedef advance_c::type advanced; + MPL_ASSERT(( is_same )); +}