diff --git a/README.md b/README.md index 4df10ad..97a037a 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Single header implementation of `std::expected` with functional-style extensions Clang + GCC: [![Linux Build Status](https://travis-ci.org/TartanLlama/expected.png?branch=master)](https://travis-ci.org/TartanLlama/expected) MSVC: [![Windows Build Status](https://ci.appveyor.com/api/projects/status/k5x00xa11y3s5wsg?svg=true)](https://ci.appveyor.com/project/TartanLlama/expected) +Available on [Vcpkg](https://github.com/microsoft/vcpkg/tree/master/ports/tl-expected) and [Conan](https://github.com/yipdw/conan-tl-expected). + [`std::expected`](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0323r3.pdf) is proposed as the preferred way to represent object which will either have an expected value, or an unexpected value giving information about why something failed. Unfortunately, chaining together many computations which may fail can be verbose, as error-checking code will be mixed in with the actual programming logic. This implementation provides a number of utilities to make coding with `expected` cleaner. For example, instead of writing this code: diff --git a/conanfile.py b/conanfile.py deleted file mode 100644 index 2526c27..0000000 --- a/conanfile.py +++ /dev/null @@ -1,34 +0,0 @@ -from conans import ConanFile, CMake, tools - -class ExpectedConan(ConanFile): - name = "expected" - version = "master" - license = "CC0-1.0" - author = "Simon Brand " - url = "https://github.com/TartanLlama/expected" - description = "C++11/14/17 std::expected with functional-style extensions" - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "*" - - def source(self): - tools.replace_in_file('CMakeLists.txt', 'project(tl-expected)', - '''project(tl-expected) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - ''') - - def configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake - - def build(self): - cmake = self.configure_cmake() - cmake.build() - - if not tools.cross_building(self.settings): - self.run('%s/bin/tests' % self.build_folder) - - def package(self): - self.copy('*.hpp', dst='include/tl', src='include/tl') \ No newline at end of file diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt deleted file mode 100644 index f9b762f..0000000 --- a/test_package/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) - -# CTest is a testing tool that can be used to test your project. -# enable_testing() -# add_test(NAME example -# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin -# COMMAND example) \ No newline at end of file diff --git a/test_package/conanfile.py b/test_package/conanfile.py deleted file mode 100644 index 6647df7..0000000 --- a/test_package/conanfile.py +++ /dev/null @@ -1,25 +0,0 @@ -import os - -from conans import ConanFile, CMake, tools - - -class ExpectedTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - - def build(self): - cmake = CMake(self) - # Current dir is "test_package/build/" and CMakeLists.txt is - # in "test_package" - cmake.configure() - cmake.build() - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='bin', src='lib') - - def test(self): - if not tools.cross_building(self.settings): - os.chdir("bin") - self.run(".%sexample" % os.sep) \ No newline at end of file diff --git a/test_package/example.cpp b/test_package/example.cpp deleted file mode 100644 index ae139d8..0000000 --- a/test_package/example.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -tl::expected maybe_do_something(int i) { - if (i < 5) { - return 0; - } - else { - return tl::make_unexpected("Uh oh"); - } -} - -int main(int argc, char** argv) { - (void)argv; - - return maybe_do_something(0).value_or(-1); -} \ No newline at end of file