typelist.h (typelist_append): To append_typelist.

2006-06-27  Benjamin Kosnik  <bkoz@redhat.com>

	* include/ext/typelist.h (typelist_append): To append_typelist. 
	(typelist): To node.
	Enclose in namespace typelist.
	* testsuite/util/testsuite_common_types.h: Adjust names, namespaces.
	* testsuite/performance/23_containers/find/map.cc: Same.
	* testsuite/performance/23_containers/create/map.cc: Same.
	* testsuite/performance/23_containers/insert_erase/associative.cc: 
	Same.
	* testsuite/performance/23_containers/insert/sequence.cc: Same.
	* testsuite/performance/23_containers/insert/associative.cc: Same.
	* testsuite/performance/23_containers/create_from_sorted/set.cc: Same.
	* testsuite/performance/23_containers/index/map.cc: Same.
	* testsuite/performance/23_containers/insert_from_sorted/set.cc: Same.
	* testsuite/performance/23_containers/create_sort/list.cc: Same.
	* testsuite/performance/23_containers/sort_search/list.cc: Same.
	* testsuite/performance/23_containers/producer_consumer/sequence.cc: 
	Same.
	* testsuite/performance/23_containers/producer_consumer/associative.cc:
	Same.

From-SVN: r115037
This commit is contained in:
Benjamin Kosnik 2006-06-27 19:20:06 +00:00
parent 776862ddc1
commit cad367a62b
14 changed files with 69 additions and 64 deletions

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
// Copyright (C) 2005 Free Software Foundation, Inc.
// Copyright (C) 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -48,13 +48,12 @@
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// XXX namespace typelist
// struct typelist -> struct node
namespace typelist
{
struct null_type { };
template<typename Root>
struct typelist
struct node
{
typedef Root root;
};
@ -71,7 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
struct append;
template<typename Typelist_Typelist>
struct typelist_append;
struct append_typelist;
template<typename Typelist, typename T>
struct contains;
@ -87,12 +86,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
template<typename Typelist, template<typename T> class Transform>
struct transform;
} // namespace typelist
_GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
namespace typelist
{
namespace detail
{
// #include <ext/detail/type_utils.h>
@ -245,32 +247,35 @@ namespace detail
typedef chain<transform_type, rest_type> type;
};
// #include <ext/detail/typelist_append.h>
// #include <ext/detail/append_typelist.h>
template<typename Typelist_Typelist_Chain>
struct typelist_append_;
struct append_typelist_;
template<typename Hd>
struct typelist_append_<chain<Hd, null_type> >
struct append_typelist_<chain<Hd, null_type> >
{
typedef chain<Hd, null_type> type;
};
template<typename Hd, typename Tl>
struct typelist_append_<chain< Hd, Tl> >
struct append_typelist_<chain< Hd, Tl> >
{
private:
typedef typename typelist_append_<Tl>::type rest;
typedef typename append_typelist_<Tl>::type rest;
public:
typedef typename append<Hd, typelist<rest> >::type::root type;
typedef typename append<Hd, node<rest> >::type::root type;
};
} // namespace detail
} // namespace typelist
_GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
namespace typelist
{
template<typename Fn, typename Typelist>
struct apply
{
@ -292,18 +297,18 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef detail::append_<root0_type, root1_type> append_type;
public:
typedef typelist<typename append_type::type> type;
typedef node<typename append_type::type> type;
};
template<typename Typelist_Typelist>
struct typelist_append
struct append_typelist
{
private:
typedef typename Typelist_Typelist::root root_type;
typedef detail::typelist_append_<root_type> append_type;
typedef detail::append_typelist_<root_type> append_type;
public:
typedef typelist<typename append_type::type> type;
typedef node<typename append_type::type> type;
};
template<typename Typelist, typename T>
@ -325,7 +330,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef detail::chain_filter_<root_type, Pred> filter_type;
public:
typedef typelist<typename filter_type::type> type;
typedef node<typename filter_type::type> type;
};
template<typename Typelist, int i>
@ -345,27 +350,27 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
typedef detail::chain_transform_<root_type, Transform> transform_type;
public:
typedef typelist<typename transform_type::type> type;
typedef node<typename transform_type::type> type;
};
} // namespace typelist
_GLIBCXX_END_NAMESPACE
#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::chain<X0, __gnu_cxx::null_type>
#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >
#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >
#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >
#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >
#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type>
#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >
#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >
#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >
#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >
#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
#define _GLIBCXX_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
#define _GLIBCXX_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
#define _GLIBCXX_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
#define _GLIBCXX_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
#define _GLIBCXX_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
#define _GLIBCXX_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
#define _GLIBCXX_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
#define _GLIBCXX_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
#define _GLIBCXX_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
#endif

View File

@ -1,6 +1,6 @@
// 2003-03-01 gp dot bolton at computer dot org
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -54,7 +54,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("create");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -64,7 +64,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("create_from_sorted");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -57,7 +57,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("create_sort");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -60,7 +60,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("find");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -63,7 +63,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("index_associative");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -65,7 +65,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_associative");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -61,7 +61,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_sequence");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -68,7 +68,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_erase_associative");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -81,7 +81,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("insert_from_sorted");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -246,11 +246,11 @@ main()
typedef __gnu_test::maps<test_type, thread_type>::type map_typelist;
typedef __gnu_test::sets<test_type, thread_type>::type set_typelist;
typedef __gnu_cxx::append<map_typelist, set_typelist>::type container_types;
typedef __gnu_cxx::typelist::append<map_typelist, set_typelist>::type container_types;
typedef test_sequence<thread_type> test_type;
test_type test("producer_consumer_associative");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -249,7 +249,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("producer_consumer_sequence");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -76,7 +76,7 @@ main()
typedef test_sequence<thread_type> test_type;
test_type test("sort_search");
__gnu_cxx::apply<test_type, container_types> applier;
__gnu_cxx::typelist::apply<test_type, container_types> applier;
applier(test);
return 0;

View File

@ -54,9 +54,9 @@
namespace __gnu_test
{
using __gnu_cxx::typelist;
using __gnu_cxx::transform;
using __gnu_cxx::append;
using __gnu_cxx::typelist::node;
using __gnu_cxx::typelist::transform;
using __gnu_cxx::typelist::append;
// All the allocators to test.
template<typename Tp, bool Thread>
@ -69,7 +69,7 @@ namespace __gnu_test
typedef __gnu_cxx::__mt_alloc<Tp, pool_policy> a3;
typedef __gnu_cxx::bitmap_allocator<Tp> a4;
typedef __gnu_cxx::__pool_alloc<Tp> a5;
typedef typelist<_GLIBCXX_TYPELIST_CHAIN5(a1, a2, a3, a4, a5)> type;
typedef node<_GLIBCXX_TYPELIST_CHAIN5(a1, a2, a3, a4, a5)> type;
};
// Typelists for vector, string, list, deque.
@ -385,7 +385,7 @@ template<bool Thread>
template<class Container>
void
operator()(__gnu_cxx::detail::type_to_type<Container>)
operator()(__gnu_cxx::typelist::detail::type_to_type<Container>)
{
const int i = 20000;
test_container<Container, i, Thread>(_M_filename);