[phobos] [D-Programming-Language/phobos] 51248e: std.variant: Implement applyVisitor and applyDeleg...

GitHub noreply at github.com
Fri Sep 28 04:54:45 PDT 2012


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: 51248e8f97072bb36135e63d8636d3761a5ca7e5
      https://github.com/D-Programming-Language/phobos/commit/51248e8f97072bb36135e63d8636d3761a5ca7e5
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-02-29 (Wed, 29 Feb 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: Implement applyVisitor and applyDelegate.

applyVisitor allows to apply a visitor to the given Algebraic depending
on its held type. It works like boost::apply_visitor of Boost.Variant.
A visitor is specified as a structure
or class which implements opCall overloads for each supported type of the
Algebraic. The function statically ensures that all types are handled by the
visitor.

applyDelegate works like applyVisitor but allows to specfiy the visiting
functions as delegates or static functions. Static checks ensure that
all types are handled and only allowed delegates are passed to the function.


  Commit: 9920a832272188cd24b948fc4dd7fce77866dd39
      https://github.com/D-Programming-Language/phobos/commit/9920a832272188cd24b948fc4dd7fce77866dd39
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-02-29 (Wed, 29 Feb 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: applyVisitor had unnecessary template restriction.


  Commit: 1894c9f24d6e04c905c7697ebf7872898ed7995d
      https://github.com/D-Programming-Language/phobos/commit/1894c9f24d6e04c905c7697ebf7872898ed7995d
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-03-22 (Thu, 22 Mar 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: Updated pull request according to klickverbot's comments.

- Now compiles now on 64bit. size_t -> int cast in unittest has been the problem. Unittests and documentation has been updated.
- Updated template constraints: applyDelegates doesn't need one as the previous constraint is implicitly checked during instation. applyVisitor now has an additional template constraint to just allow Algebraic types.
- Must not compile code in unittests has been replaced by static assert and __trait(compiles) checks.


  Commit: 3ed21ffb389679996507d1d323af10c248ce83a1
      https://github.com/D-Programming-Language/phobos/commit/3ed21ffb389679996507d1d323af10c248ce83a1
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-03-25 (Sun, 25 Mar 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: Added more explicit template constraint to applyDelegate which checks for a Algebraic type.

The new constraint isAlgebraic checks for all member functions and types used from  Algebraic and makes it hard to call the applyDelegate with arbitrary types.


  Commit: 855451e6f9cd77616ac017bdd09d8586fbcfc42e
      https://github.com/D-Programming-Language/phobos/commit/855451e6f9cd77616ac017bdd09d8586fbcfc42e
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-06-09 (Sat, 09 Jun 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  New implementation of visit and tryVisit that allows visitor structs and classes as well as delegate functions to be passed as parameters.

tryVisit is a new function which doesn't statically ensures that all types are handled by the visiting
functions. A VariantException is thrown if the algebraic holds a value which isn't handled by
the visitors.

visit and tryVisit share a common private template function as backend which does all the magic. applyDelegate and
applyVisitor have practically been merged into one new function.


  Commit: a9ebb09b89ecf6efd2613607a28b96413d679ec1
      https://github.com/D-Programming-Language/phobos/commit/a9ebb09b89ecf6efd2613607a28b96413d679ec1
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-02 (Sun, 02 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Updated visit to allow just delegates passed using the template parameter list.


  Commit: 4db7ccca0917083a83520c917e529afef18d342f
      https://github.com/D-Programming-Language/phobos/commit/4db7ccca0917083a83520c917e529afef18d342f
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-05 (Wed, 05 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  visit and tryVisit have been extended to allow at most one function with no parameters which is called in case of errors (variant doesn't hold a value or in case of tryVisit, holds a value which can't be handled by visiting functions).


  Commit: dd869b75f165ee59fe231002b60026f2b8e2c02c
      https://github.com/D-Programming-Language/phobos/commit/dd869b75f165ee59fe231002b60026f2b8e2c02c
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: Implement applyVisitor and applyDelegate.

applyVisitor allows to apply a visitor to the given Algebraic depending
on its held type. It works like boost::apply_visitor of Boost.Variant.
A visitor is specified as a structure
or class which implements opCall overloads for each supported type of the
Algebraic. The function statically ensures that all types are handled by the
visitor.

applyDelegate works like applyVisitor but allows to specfiy the visiting
functions as delegates or static functions. Static checks ensure that
all types are handled and only allowed delegates are passed to the function.


  Commit: 7aa8d1b7d11cc441c29c05adc65b805c529b8bc2
      https://github.com/D-Programming-Language/phobos/commit/7aa8d1b7d11cc441c29c05adc65b805c529b8bc2
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: applyVisitor had unnecessary template restriction.


  Commit: 95fcb05bfa0c28d87da0110fac530ce840ca970d
      https://github.com/D-Programming-Language/phobos/commit/95fcb05bfa0c28d87da0110fac530ce840ca970d
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: Updated pull request according to klickverbot's comments.

- Now compiles now on 64bit. size_t -> int cast in unittest has been the problem. Unittests and documentation has been updated.
- Updated template constraints: applyDelegates doesn't need one as the previous constraint is implicitly checked during instation. applyVisitor now has an additional template constraint to just allow Algebraic types.
- Must not compile code in unittests has been replaced by static assert and __trait(compiles) checks.


  Commit: 05cb2c08a2e68791a868887686118369372764b5
      https://github.com/D-Programming-Language/phobos/commit/05cb2c08a2e68791a868887686118369372764b5
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: Added more explicit template constraint to applyDelegate which checks for a Algebraic type.

The new constraint isAlgebraic checks for all member functions and types used from  Algebraic and makes it hard to call the applyDelegate with arbitrary types.


  Commit: 8eec1a2502a6da8be891fbebb7314777999bb1ad
      https://github.com/D-Programming-Language/phobos/commit/8eec1a2502a6da8be891fbebb7314777999bb1ad
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  New implementation of visit and tryVisit that allows visitor structs and classes as well as delegate functions to be passed as parameters.

tryVisit is a new function which doesn't statically ensures that all types are handled by the visiting
functions. A VariantException is thrown if the algebraic holds a value which isn't handled by
the visitors.

visit and tryVisit share a common private template function as backend which does all the magic. applyDelegate and
applyVisitor have practically been merged into one new function.


  Commit: 692916fbd9bcd71e9fa763a5ca9d0e9a1417eae4
      https://github.com/D-Programming-Language/phobos/commit/692916fbd9bcd71e9fa763a5ca9d0e9a1417eae4
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Updated visit to allow just delegates passed using the template parameter list.


  Commit: 7469408f81553fb6f0db437246d6527a3b700c71
      https://github.com/D-Programming-Language/phobos/commit/7469408f81553fb6f0db437246d6527a3b700c71
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  visit and tryVisit have been extended to allow at most one function with no parameters which is called in case of errors (variant doesn't hold a value or in case of tryVisit, holds a value which can't be handled by visiting functions).


  Commit: 28ccc78c9512652bf12515525ba66387a00e1f2c
      https://github.com/D-Programming-Language/phobos/commit/28ccc78c9512652bf12515525ba66387a00e1f2c
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-13 (Thu, 13 Sep 2012)

  Log Message:
  -----------
  Merge branch 'master' of github.com:/stonemaster/phobos


  Commit: 038813a4c8ab8e3dfa554f3211cadfb5dafea8a0
      https://github.com/D-Programming-Language/phobos/commit/038813a4c8ab8e3dfa554f3211cadfb5dafea8a0
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-22 (Sat, 22 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Fix warnings, auto tester should succeed now.


  Commit: a14142d3fb47261f566b94ac35f3a3de6b8c9647
      https://github.com/D-Programming-Language/phobos/commit/a14142d3fb47261f566b94ac35f3a3de6b8c9647
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-27 (Thu, 27 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Integrated first chunk of changes of Andrei's review.


  Commit: 62223f51da039d733d1c133050e5ebcf640917fa
      https://github.com/D-Programming-Language/phobos/commit/62223f51da039d733d1c133050e5ebcf640917fa
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-27 (Thu, 27 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Fixed auto tester errors - () forgotten in visit call.


  Commit: 69faa7ab24b82f82f08d4eb40debfd0008cf2d43
      https://github.com/D-Programming-Language/phobos/commit/69faa7ab24b82f82f08d4eb40debfd0008cf2d43
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-27 (Thu, 27 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Fixed comments (ouch).


  Commit: b01ef30580ecaed3c96dc8e83025bc493da8137e
      https://github.com/D-Programming-Language/phobos/commit/b01ef30580ecaed3c96dc8e83025bc493da8137e
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-27 (Thu, 27 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Integrated 9rnsr's suggestions.


  Commit: f5600708b451df7cb1eacae17950ec35b08e6c42
      https://github.com/D-Programming-Language/phobos/commit/f5600708b451df7cb1eacae17950ec35b08e6c42
  Author: André Stein <andre.stein.1985 at gmail.com>
  Date:   2012-09-27 (Thu, 27 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Changes according to 9rnsr's review.


  Commit: 07765d1a2f7fc1f253c748d6dfde828deff25b70
      https://github.com/D-Programming-Language/phobos/commit/07765d1a2f7fc1f253c748d6dfde828deff25b70
  Author: Andrei Alexandrescu <andrei at erdani.com>
  Date:   2012-09-28 (Fri, 28 Sep 2012)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Merge pull request #468 from stonemaster/master

std.variant: Implement applyVisitor and applyDelegate


Compare: https://github.com/D-Programming-Language/phobos/compare/bf119860f493...07765d1a2f7f


More information about the phobos mailing list