Patchwork [v3] make std::ignore const

login
register
mail settings
Submitter Jonathan Wakely
Date June 11, 2010, 3:03 p.m.
Message ID <AANLkTikeHcYZPUzbTj54febSkVGghajto2MHmioj0m9A@mail.gmail.com>
Download mbox | patch
Permalink /patch/55335/
State New
Headers show

Comments

Jonathan Wakely - June 11, 2010, 3:03 p.m.
The FCD requires std::ignore to be a const instance of some
unspecified type, which the patch below implements by making
_Swallow_assign::operator= work on const objects.

The unnamed namespace is not needed because namespace-scope const
objects are static by default.

Test x86_64/Linux and committed to trunk.

 	* include/std/tuple (_Swallow_assign::operator=): Add const.
	(ignore): Replace anonymous namespace member with const instance.

Patch

Index: include/std/tuple
===================================================================
--- include/std/tuple   (revision 160324)
+++ include/std/tuple   (working copy)
@@ -690,16 +690,12 @@  namespace std
  struct _Swallow_assign
  {
    template<class _Tp>
-      _Swallow_assign&
-      operator=(const _Tp&)
+      const _Swallow_assign&
+      operator=(const _Tp&) const
      { return *this; }
  };

-  // TODO: Put this in some kind of shared file.
-  namespace
-  {
-    _Swallow_assign ignore;
-  }; // anonymous namespace
+  const _Swallow_assign ignore{};

  /**
   * Stores a tuple of indices. Used by bind() to extract the elements