59cffcf69a
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
79 lines
2.8 KiB
C++
79 lines
2.8 KiB
C++
// TR1 functional -*- 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
// 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_iterate.h
|
|
* This is an internal header file, included by other library headers.
|
|
* You should not attempt to use it directly.
|
|
*/
|
|
|
|
#if _GLIBCXX_BIND_NUM_ARGS > 0
|
|
template<_GLIBCXX_BIND_TEMPLATE_PARAMS>
|
|
#endif
|
|
#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE
|
|
result_type
|
|
#else
|
|
typename result_of<_Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS())>::type
|
|
#endif
|
|
operator()(_GLIBCXX_BIND_PARAMS)
|
|
{ return _M_f(_GLIBCXX_BIND_V_ARGS); }
|
|
|
|
#if _GLIBCXX_BIND_NUM_ARGS > 0
|
|
template<_GLIBCXX_BIND_TEMPLATE_PARAMS>
|
|
#endif
|
|
#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE
|
|
result_type
|
|
#else
|
|
typename result_of<const _Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS(const))>::type
|
|
#endif
|
|
operator()(_GLIBCXX_BIND_PARAMS) const
|
|
{ return _M_f(_GLIBCXX_BIND_V_ARGS); }
|
|
|
|
#if _GLIBCXX_BIND_NUM_ARGS > 0
|
|
template<_GLIBCXX_BIND_TEMPLATE_PARAMS>
|
|
#endif
|
|
#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE
|
|
result_type
|
|
#else
|
|
typename result_of<volatile _Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS(volatile))>::type
|
|
#endif
|
|
operator()(_GLIBCXX_BIND_PARAMS) volatile
|
|
{ return _M_f(_GLIBCXX_BIND_V_ARGS); }
|
|
|
|
#if _GLIBCXX_BIND_NUM_ARGS > 0
|
|
template<_GLIBCXX_BIND_TEMPLATE_PARAMS>
|
|
#endif
|
|
#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE
|
|
result_type
|
|
#else
|
|
typename result_of<const volatile _Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS(const volatile))>::type
|
|
#endif
|
|
operator()(_GLIBCXX_BIND_PARAMS) const volatile
|
|
{ return _M_f(_GLIBCXX_BIND_V_ARGS); }
|