Skip to content
Repository for a C++11 implementation of std::out_ptr (p1132), targeting Boost 1.71 as boost.out_ptr!
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add license file May 24, 2019
benchmark_results update out_ptr fully Jun 12, 2019
benchmarks update out_ptr fully Jun 12, 2019
cmake Add license file May 24, 2019
docs improve documentation Jun 10, 2019
examples Ensure we properly write the file at config time. Jun 12, 2019
include/boost update default noexcept specification Jun 4, 2019
tests update out_ptr fully Jun 12, 2019
vendor update to latest google/benchmark Jun 12, 2019
.appveyor.yml I very much dislike C++11. Jun 2, 2019
.clang-format Add license file May 24, 2019
.gitignore Add license file May 24, 2019
.gitmodules Adding examples and buffing out C++11 quirks. Fix #5 Fix #4 Fix #3 Fix May 8, 2019
.style.yapf Add license file May 24, 2019
.travis.yml As usual, Mac OSX is fucked on travis for some reason May 25, 2019
CMakeLists.txt
LICENSE Add license file May 24, 2019
README.md

README.md

boost.out_ptr

boost.out_ptr is a simple parameter wrapper for output pointers.

Linux & Max OSX Build Status Build status

Quick Comparison and Example

// Before
std::unique_ptr<Obj, ObjDeleter> ptr;

if (T* tmp_ptr; !c_api_get_obj(&tmp_ptr, ...)) {
  throw std::runtime_error(...);
}
else {
  ptr.reset(tmp_ptr);
}

use(ptr);
// After
using bop = boost::out_ptr;
std::unique_ptr<Obj, ObjDeleter> ptr;

if (!c_api_get_obj(bop::inout_ptr(ptr), ...)) {
  throw std::runtime_error(...);
}

use(ptr);

Full Examples and Documentation

There are examples and documentation contained in this repository: please, peruse them as much as you need to! Some interesting/illuminating ones:

Running Tests

Right now, can be run easily VIA CMake. To ease development, all necessary dependencies -- including other Boost dependencies -- are included as submodules. You can initialize and update all submodules by performing a successful git submodule update --init --recursive call.

From there, CMake is run. It requires that the parameters BOOST_OUT_PTR_TESTS is ON. Examples can also be run by specifying BOOST_OUT_PTR_EXAMPLES and BOOST_OUT_PTR_TESTS to be ON at the same time:

md out_ptr-build
cd out_ptr-build
cmake path/to/out_ptr/src -GNinja -DBOOST_OUT_PTR_TESTS=ON -DBOOST_OUT_PTR_EXAMPLES=ON
cmake --build .
ctest --output-on-failure

You can replace the -G argument with the generator of your choice. You may also add the -DCMAKE_BUILD_TYPE=Debug|Release to test certain build types. If you do, make sure to specify it on the build and test lines as well with cmake --build . --config Debug|Release and ctest --output-on-failure --build-config=Debug|Release.

Running Benchmarks

Benchmarks can be run by running CMake with the option -DBOOST_OUT_PTR_BENCHMARKS set to ON.

You can’t perform that action at this time.