gcc/libstdc++-v3/include/tr1/bind_repeat.h

193 lines
8.1 KiB
C
Raw Normal View History

[multiple changes] 2005-03-31 Chris Jefferson <chris@bubblescope.net> * include/tr1/tuple: Support iteration via tuple_iterate.h. * include/tr1/tuple_iterate.h: Iteration file for tuple. 2005-03-31 Douglas Gregor <doug.gregor@gmail.com> * include/Makefile.am (tr1_headers): Add bind and mu repetition headers and reference_wrapper<> forwarding header. * include/Makefile.in: Regenerate. * include/tr1/bind_iterate.h: Implementation of function call operators for the function object returned from tr1::bind(). * include/tr1/bind_repeat.h: Bind-specific repetition header, akin to include/tr1/repeat.h. * include/tr1/functional (_Mem_fn): Bug fix: declare result member template for use with result_of. (is_bind_expression): New. (is_placeholder): New. (_Placeholder): New. Placeholder type for bind. (_Mu): New. Implementation detail of bind. (_Bind, _Bind_result): New. Function objects returned by bind. (_GLIBCXX_JOIN): New. Required to create bind placeholders. * include/tr1/functional_iterate.h (_Bind, _Bind_result, bind): New. Implementation of tr1::bind. * include/tr1/mu_iterate.h (_Mu): result template and operator() for the _Mu helper to bind. * include/tr1/ref_fwd.h (reference_wrapper): Forward declaration used by tuple header. (ref): Ditto. (cref): Ditto. * include/tr1/repeat.h: Add bind-specific repetition macros. * include/tr1/tuple: Use reference_wrapper forwarding header for initial definitions, then include <tr1/functional> at the end, to make the circular dependencies work. (tie): Support zero-argument tie() function. * testsuite/tr1/3_function_objects/bind/all_bound.cc: New test of bind() functionality with parameters bound. * testsuite/tr1/3_function_objects/bind/nested.cc: New test of nested bind() expressions. * testsuite/tr1/3_function_objects/bind/placeholders.cc: New test of bind() placeholders. * testsuite/tr1/3_function_objects/bind/ref.cc: New test of bind() with arguments bound via reference_wrapper<>. * scripts/gen_includers.pl: Generate the repetitive part of include/tr1/repeat.h. * scripts/gen_bind_includers.pl: Generate the repetitive part of include/tr1/bind_repeat.h. From-SVN: r97361
2005-04-01 05:35:59 +02:00
// TR1 code repetition for bind -*- C++ -*-
// Copyright (C) 2005 Free Software Foundation, Inc.
// Written by Douglas Gregor <doug.gregor -at- gmail.com>
//
// 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
[multiple changes] 2005-03-31 Chris Jefferson <chris@bubblescope.net> * include/tr1/tuple: Support iteration via tuple_iterate.h. * include/tr1/tuple_iterate.h: Iteration file for tuple. 2005-03-31 Douglas Gregor <doug.gregor@gmail.com> * include/Makefile.am (tr1_headers): Add bind and mu repetition headers and reference_wrapper<> forwarding header. * include/Makefile.in: Regenerate. * include/tr1/bind_iterate.h: Implementation of function call operators for the function object returned from tr1::bind(). * include/tr1/bind_repeat.h: Bind-specific repetition header, akin to include/tr1/repeat.h. * include/tr1/functional (_Mem_fn): Bug fix: declare result member template for use with result_of. (is_bind_expression): New. (is_placeholder): New. (_Placeholder): New. Placeholder type for bind. (_Mu): New. Implementation detail of bind. (_Bind, _Bind_result): New. Function objects returned by bind. (_GLIBCXX_JOIN): New. Required to create bind placeholders. * include/tr1/functional_iterate.h (_Bind, _Bind_result, bind): New. Implementation of tr1::bind. * include/tr1/mu_iterate.h (_Mu): result template and operator() for the _Mu helper to bind. * include/tr1/ref_fwd.h (reference_wrapper): Forward declaration used by tuple header. (ref): Ditto. (cref): Ditto. * include/tr1/repeat.h: Add bind-specific repetition macros. * include/tr1/tuple: Use reference_wrapper forwarding header for initial definitions, then include <tr1/functional> at the end, to make the circular dependencies work. (tie): Support zero-argument tie() function. * testsuite/tr1/3_function_objects/bind/all_bound.cc: New test of bind() functionality with parameters bound. * testsuite/tr1/3_function_objects/bind/nested.cc: New test of nested bind() expressions. * testsuite/tr1/3_function_objects/bind/placeholders.cc: New test of bind() placeholders. * testsuite/tr1/3_function_objects/bind/ref.cc: New test of bind() with arguments bound via reference_wrapper<>. * scripts/gen_includers.pl: Generate the repetitive part of include/tr1/repeat.h. * scripts/gen_bind_includers.pl: Generate the repetitive part of include/tr1/bind_repeat.h. From-SVN: r97361
2005-04-01 05:35:59 +02:00
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/** @file bind_repeat.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#ifndef _GLIBCXX_BIND_REPEAT_HEADER
# error Internal error: _GLIBCXX_BIND_REPEAT_HEADER must be set
#endif /* _GLIBCXX_BIND_REPEAT_HEADER */
#define _GLIBCXX_BIND_NUM_ARGS 0
#define _GLIBCXX_BIND_COMMA
#define _GLIBCXX_BIND_TEMPLATE_PARAMS
#define _GLIBCXX_BIND_TEMPLATE_ARGS
#define _GLIBCXX_BIND_PARAMS
#define _GLIBCXX_BIND_ARGS
# include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 1
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1
#define _GLIBCXX_BIND_PARAMS _U1& __u1
#define _GLIBCXX_BIND_ARGS __u1
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 2
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2
#define _GLIBCXX_BIND_ARGS __u1, __u2
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 3
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 4
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 5
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 6
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 7
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 8
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7, _U8& __u8
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7, __u8
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 9
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8, typename _U9
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7, _U8& __u8, _U9& __u9
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7, __u8, __u9
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS
#define _GLIBCXX_BIND_NUM_ARGS 10
#define _GLIBCXX_BIND_COMMA ,
#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8, typename _U9, typename _U10
#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10
#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7, _U8& __u8, _U9& __u9, _U10& __u10
#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7, __u8, __u9, __u10
#include _GLIBCXX_BIND_REPEAT_HEADER
#undef _GLIBCXX_BIND_ARGS
#undef _GLIBCXX_BIND_PARAMS
#undef _GLIBCXX_BIND_TEMPLATE_ARGS
#undef _GLIBCXX_BIND_TEMPLATE_PARAMS
#undef _GLIBCXX_BIND_COMMA
#undef _GLIBCXX_BIND_NUM_ARGS