Add either type (#19285)
authorSebastian Messmer <messmer@fb.com>
Thu, 18 Apr 2019 09:00:49 +0000 (02:00 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 18 Apr 2019 09:04:43 +0000 (02:04 -0700)
commita456e1e19669fb3c17de75456570aab911f9476f
tree1ba196c0c304193f31e8eecda52603c96fc19d04
parent12dcc77bcb1233aa805858862618e595e49ff3ec
Add either type (#19285)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19285

The either type is a tagged union with two members.
This is going to be used in a diff stacked on top to allow a function to return one of two types.

Also, generally, either<Error, Result> is a great pattern for returning value_or_error from a function without using exceptions and we could use this class for that later.

Reviewed By: dzhulgakov

Differential Revision: D14931923

fbshipit-source-id: 7d1dd77b3e5b655f331444394dcdeab24772ab3a
c10/test/CMakeLists.txt
c10/test/util/either_test.cpp [new file with mode: 0644]
c10/util/either.h [new file with mode: 0644]
cmake/Dependencies.cmake