Merge branch 'feature/library_intermediate' into feature/library_intermediate2
This commit is contained in:
commit
7868acad1a
@ -90,12 +90,12 @@ references:
|
||||
restore_cache:
|
||||
keys:
|
||||
# Find the most recent cache from any branch
|
||||
- v3_upgrade_boost_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
|
||||
- v4_upgrade_boost_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
|
||||
upgrade_boost_post: &upgrade_boost_post
|
||||
save_cache:
|
||||
key: v3_upgrade_boost_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
|
||||
key: v4_upgrade_boost_cache_{{ checksum "/tmp/_build_env_vars" }}_{{ arch }}
|
||||
paths:
|
||||
- /tmp/boost_1_57_0
|
||||
- /tmp/boost_1_58_0
|
||||
upgrade_boost: &upgrade_boost
|
||||
run:
|
||||
name: Upgrade Boost
|
||||
@ -104,10 +104,10 @@ references:
|
||||
export NUMCORES=`nproc`
|
||||
echo Using $NUMCORES cores
|
||||
# Download and prepare boost (only if not already present from cache)
|
||||
if [ ! -d "/tmp/boost_1_57_0" ]; then
|
||||
if [ ! -d "/tmp/boost_1_58_0" ]; then
|
||||
echo "Didn't find boost in cache. Downloading and building."
|
||||
wget -O /tmp/boost.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.57.0/boost_1_57_0.tar.bz2/download
|
||||
if [ $(sha512sum /tmp/boost.tar.bz2 | awk '{print $1;}') == "61881440fd89644c43c6e3bc6292e9fed75a6d3a76f98654b189d0ed4e1087d77b585884e882270c08bf9f7132b173bfc1fde05848e06aa78ba7f1008d10714d" ]; then
|
||||
wget -O /tmp/boost.tar.bz2 https://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.bz2/download
|
||||
if [ $(sha512sum /tmp/boost.tar.bz2 | awk '{print $1;}') == "7480ec713b0aa13f0ec990603e87e3b5c8d53f4411329b10fae37fc963b90aad12dbd9290a33c3669ae801e9012a68683eadff057591e9ca2ebcd22b1a67b5d1" ]; then
|
||||
echo Correct sha512sum
|
||||
else
|
||||
echo Wrong sha512sum
|
||||
@ -117,14 +117,14 @@ references:
|
||||
echo Extracting...
|
||||
tar -xf /tmp/boost.tar.bz2 -C /tmp
|
||||
rm -rf boost.tar.bz2
|
||||
cd /tmp/boost_1_57_0
|
||||
cd /tmp/boost_1_58_0
|
||||
./bootstrap.sh --with-toolset=${BUILD_TOOLSET} --with-libraries=filesystem,thread,chrono,program_options
|
||||
cd ..
|
||||
else
|
||||
echo Found boost in cache. Use cache and build.
|
||||
fi
|
||||
# Compile and install boost (if cached, this should be fast)
|
||||
cd /tmp/boost_1_57_0
|
||||
cd /tmp/boost_1_58_0
|
||||
sudo ./b2 toolset=${BUILD_TOOLSET} link=static cxxflags=-fPIC -d0 -j$NUMCORES install
|
||||
build_pre: &build_pre
|
||||
restore_cache:
|
||||
|
@ -26,7 +26,7 @@ Requirements
|
||||
- GCC version >= 5.0 or Clang >= 4.0
|
||||
- CMake version >= 3.0
|
||||
- libcurl4 (including development headers)
|
||||
- Boost libraries version >= 1.57 (including development headers)
|
||||
- Boost libraries version >= 1.58 (including development headers)
|
||||
- filesystem
|
||||
- system
|
||||
- chrono
|
||||
|
@ -108,7 +108,7 @@ endfunction(target_enable_style_warnings)
|
||||
function(target_add_boost TARGET)
|
||||
# Load boost libraries
|
||||
if(NOT DEFINED Boost_USE_STATIC_LIBS OR Boost_USE_STATIC_LIBS)
|
||||
# Many supported systems don't have boost >= 1.57. Better link it statically.
|
||||
# Many supported systems don't have boost >= 1.58. Better link it statically.
|
||||
message(STATUS "Boost will be statically linked")
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
else(NOT DEFINED Boost_USE_STATIC_LIBS OR Boost_USE_STATIC_LIBS)
|
||||
@ -116,7 +116,7 @@ function(target_add_boost TARGET)
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
endif(NOT DEFINED Boost_USE_STATIC_LIBS OR Boost_USE_STATIC_LIBS)
|
||||
set(BOOST_THREAD_VERSION 4)
|
||||
find_package(Boost 1.57.0
|
||||
find_package(Boost 1.58.0
|
||||
REQUIRED
|
||||
COMPONENTS ${ARGN})
|
||||
target_include_directories(${TARGET} SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
|
||||
|
@ -8,217 +8,224 @@
|
||||
|
||||
namespace cpputils {
|
||||
|
||||
template<class Left, class Right>
|
||||
class either final {
|
||||
public:
|
||||
template<class Head, class... Tail, std::enable_if_t<std::is_constructible<Left, Head, Tail...>::value && !std::is_constructible<Right, Head, Tail...>::value>* = nullptr>
|
||||
either(Head&& construct_left_head_arg, Tail&&... construct_left_tail_args) noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(std::forward<Head>(construct_left_head_arg), std::forward<Tail>(construct_left_tail_args)...)))
|
||||
: _side(Side::left) {
|
||||
_construct_left(std::forward<Head>(construct_left_head_arg), std::forward<Tail>(construct_left_tail_args)...);
|
||||
}
|
||||
template<class Left, class Right>
|
||||
class either final {
|
||||
public:
|
||||
template<class Head, class... Tail, std::enable_if_t<std::is_constructible<Left, Head, Tail...>::value && !std::is_constructible<Right, Head, Tail...>::value>* = nullptr>
|
||||
either(Head&& construct_left_head_arg, Tail&&... construct_left_tail_args) noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(std::forward<Head>(construct_left_head_arg), std::forward<Tail>(construct_left_tail_args)...)))
|
||||
: _side(Side::left) {
|
||||
_construct_left(std::forward<Head>(construct_left_head_arg), std::forward<Tail>(construct_left_tail_args)...);
|
||||
}
|
||||
|
||||
template<class Head, class... Tail, std::enable_if_t<!std::is_constructible<Left, Head, Tail...>::value && std::is_constructible<Right, Head, Tail...>::value>* = nullptr>
|
||||
either(Head&& construct_right_head_arg, Tail&&... construct_right_tail_args) noexcept(noexcept(std::declval<either<Left, Right>>()._construct_right(std::forward<Head>(construct_right_head_arg), std::forward<Tail>(construct_right_tail_args)...)))
|
||||
: _side(Side::right) {
|
||||
_construct_right(std::forward<Head>(construct_right_head_arg), std::forward<Tail>(construct_right_tail_args)...);
|
||||
}
|
||||
template<class Head, class... Tail, std::enable_if_t<!std::is_constructible<Left, Head, Tail...>::value && std::is_constructible<Right, Head, Tail...>::value>* = nullptr>
|
||||
either(Head&& construct_right_head_arg, Tail&&... construct_right_tail_args) noexcept(noexcept(std::declval<either<Left, Right>>()._construct_right(std::forward<Head>(construct_right_head_arg), std::forward<Tail>(construct_right_tail_args)...)))
|
||||
: _side(Side::right) {
|
||||
_construct_right(std::forward<Head>(construct_right_head_arg), std::forward<Tail>(construct_right_tail_args)...);
|
||||
}
|
||||
|
||||
//TODO Try allowing copy-construction when Left/Right types are std::is_convertible
|
||||
either(const either<Left, Right> &rhs) noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(rhs._left)) && noexcept(std::declval<either<Left, Right>>()._construct_right(rhs._right)))
|
||||
: _side(rhs._side) {
|
||||
if(_side == Side::left) {
|
||||
_construct_left(rhs._left);
|
||||
} else {
|
||||
_construct_right(rhs._right);
|
||||
//TODO Try allowing copy-construction when Left/Right types are std::is_convertible
|
||||
either(const either<Left, Right> &rhs) noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(rhs._left)) && noexcept(std::declval<either<Left, Right>>()._construct_right(rhs._right)))
|
||||
: _side(rhs._side) {
|
||||
if(_side == Side::left) {
|
||||
_construct_left(rhs._left);
|
||||
} else {
|
||||
_construct_right(rhs._right);
|
||||
}
|
||||
}
|
||||
|
||||
either(either<Left, Right> &&rhs) noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right))))
|
||||
: _side(rhs._side) {
|
||||
if(_side == Side::left) {
|
||||
_construct_left(std::move(rhs._left));
|
||||
} else {
|
||||
_construct_right(std::move(rhs._right));
|
||||
}
|
||||
}
|
||||
|
||||
~either() {
|
||||
_destruct();
|
||||
}
|
||||
|
||||
//TODO Try allowing copy-assignment when Left/Right types are std::is_convertible
|
||||
either<Left, Right> &operator=(const either<Left, Right> &rhs) noexcept(noexcept(_construct_left(rhs._left)) && noexcept(_construct_right(rhs._right))) {
|
||||
_destruct();
|
||||
_side = rhs._side;
|
||||
if (_side == Side::left) {
|
||||
_construct_left(rhs._left);
|
||||
} else {
|
||||
_construct_right(rhs._right);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
either<Left, Right> &operator=(either<Left, Right> &&rhs) noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right)))) {
|
||||
_destruct();
|
||||
_side = rhs._side;
|
||||
if (_side == Side::left) {
|
||||
_construct_left(std::move(rhs._left));
|
||||
} else {
|
||||
_construct_right(std::move(rhs._right));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//TODO fold, map_left, map_right, left_or_else(val), right_or_else(val), left_or_else(func), right_or_else(func)
|
||||
|
||||
bool is_left() const noexcept {
|
||||
return _side == Side::left;
|
||||
}
|
||||
|
||||
bool is_right() const noexcept {
|
||||
return _side == Side::right;
|
||||
}
|
||||
|
||||
const Left &left() const& {
|
||||
if (!is_left()) {
|
||||
throw std::logic_error("Tried to get left side of an either which is right.");
|
||||
}
|
||||
return _left;
|
||||
}
|
||||
Left &left() & {
|
||||
return const_cast<Left&>(const_cast<const either<Left, Right>*>(this)->left());
|
||||
}
|
||||
Left &&left() && {
|
||||
return std::move(left());
|
||||
}
|
||||
|
||||
const Right &right() const& {
|
||||
if (!is_right()) {
|
||||
throw std::logic_error("Tried to get right side of an either which is left.");
|
||||
}
|
||||
return _right;
|
||||
}
|
||||
Right &right() & {
|
||||
return const_cast<Right&>(const_cast<const either<Left, Right>*>(this)->right());
|
||||
}
|
||||
Right &&right() && {
|
||||
return std::move(right());
|
||||
}
|
||||
|
||||
boost::optional<const Left&> left_opt() const& noexcept {
|
||||
if (_side == Side::left) {
|
||||
return _left;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
boost::optional<Left&> left_opt() & noexcept {
|
||||
if (_side == Side::left) {
|
||||
return _left;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
// warning: opposed to the other left_opt variants, this one already moves the content and returns by value.
|
||||
boost::optional<Left> left_opt() && noexcept(noexcept(boost::optional<Left>(std::move(_left)))) {
|
||||
if (_side == Side::left) {
|
||||
return std::move(_left);
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boost::optional<const Right&> right_opt() const& noexcept {
|
||||
if (_side == Side::right) {
|
||||
return _right;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
boost::optional<Right&> right_opt() & noexcept {
|
||||
if (_side == Side::right) {
|
||||
return _right;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
// warning: opposed to the other left_opt variants, this one already moves the content and returns by value.
|
||||
boost::optional<Right> right_opt() && noexcept(noexcept(boost::optional<Right>(std::move(_right)))) {
|
||||
if (_side == Side::right) {
|
||||
return std::move(_right);
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
union {
|
||||
Left _left;
|
||||
Right _right;
|
||||
};
|
||||
enum class Side : uint8_t {left, right} _side;
|
||||
|
||||
explicit either(Side side) noexcept : _side(side) {}
|
||||
|
||||
template<typename... Args>
|
||||
void _construct_left(Args&&... args) noexcept(noexcept(new Left(std::forward<Args>(args)...))) {
|
||||
new(&_left)Left(std::forward<Args>(args)...);
|
||||
}
|
||||
template<typename... Args>
|
||||
void _construct_right(Args&&... args) noexcept(noexcept(new Right(std::forward<Args>(args)...))) {
|
||||
new(&_right)Right(std::forward<Args>(args)...);
|
||||
}
|
||||
void _destruct() noexcept {
|
||||
if (_side == Side::left) {
|
||||
_left.~Left();
|
||||
} else {
|
||||
_right.~Right();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Left_, typename Right_, typename... Args>
|
||||
friend either<Left_, Right_> make_left(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(std::forward<Args>(args)...))) */;
|
||||
|
||||
template<typename Left_, typename Right_, typename... Args>
|
||||
friend either<Left_, Right_> make_right(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_right(std::forward<Args>(args)...))) */;
|
||||
};
|
||||
|
||||
template<class Left, class Right>
|
||||
inline bool operator==(const either<Left, Right> &lhs, const either<Left, Right> &rhs) noexcept(noexcept(std::declval<Left>() == std::declval<Left>()) && noexcept(std::declval<Right>() == std::declval<Right>())) {
|
||||
if (lhs.is_left() != rhs.is_left()) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.is_left()) {
|
||||
return lhs.left() == rhs.left();
|
||||
} else {
|
||||
return lhs.right() == rhs.right();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
either(either<Left, Right> &&rhs) noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right))))
|
||||
: _side(rhs._side) {
|
||||
if(_side == Side::left) {
|
||||
_construct_left(std::move(rhs._left));
|
||||
} else {
|
||||
_construct_right(std::move(rhs._right));
|
||||
template<class Left, class Right>
|
||||
inline bool operator!=(const either<Left, Right> &lhs, const either<Left, Right> &rhs) noexcept(noexcept(operator==(lhs, rhs))) {
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
}
|
||||
|
||||
~either() {
|
||||
_destruct();
|
||||
}
|
||||
|
||||
//TODO Try allowing copy-assignment when Left/Right types are std::is_convertible
|
||||
either<Left, Right> &operator=(const either<Left, Right> &rhs) noexcept(noexcept(_construct_left(rhs._left)) && noexcept(_construct_right(rhs._right))) {
|
||||
_destruct();
|
||||
_side = rhs._side;
|
||||
if (_side == Side::left) {
|
||||
_construct_left(rhs._left);
|
||||
} else {
|
||||
_construct_right(rhs._right);
|
||||
template<class Left, class Right>
|
||||
inline std::ostream &operator<<(std::ostream &stream, const either<Left, Right> &value) {
|
||||
if (value.is_left()) {
|
||||
stream << "Left(" << value.left() << ")";
|
||||
} else {
|
||||
stream << "Right(" << value.right() << ")";
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
either<Left, Right> &operator=(either<Left, Right> &&rhs) noexcept(noexcept(_construct_left(std::move(rhs._left))) && noexcept(_construct_right(std::move(rhs._right)))) {
|
||||
_destruct();
|
||||
_side = rhs._side;
|
||||
if (_side == Side::left) {
|
||||
_construct_left(std::move(rhs._left));
|
||||
} else {
|
||||
_construct_right(std::move(rhs._right));
|
||||
template<typename Left, typename Right, typename... Args>
|
||||
inline either<Left, Right> make_left(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(std::forward<Args>(args)...))) */ {
|
||||
either<Left, Right> result(either<Left, Right>::Side::left);
|
||||
result._construct_left(std::forward<Args>(args)...);
|
||||
return result;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//TODO fold, map_left, map_right, left_or_else(val), right_or_else(val), left_or_else(func), right_or_else(func)
|
||||
|
||||
bool is_left() const noexcept {
|
||||
return _side == Side::left;
|
||||
}
|
||||
|
||||
bool is_right() const noexcept {
|
||||
return _side == Side::right;
|
||||
}
|
||||
|
||||
const Left &left() const& {
|
||||
ASSERT(is_left(), "Tried to get left side of an either which is right.");
|
||||
return _left;
|
||||
}
|
||||
Left &left() & {
|
||||
return const_cast<Left&>(const_cast<const either<Left, Right>*>(this)->left());
|
||||
}
|
||||
Left &&left() && {
|
||||
return std::move(left());
|
||||
}
|
||||
|
||||
const Right &right() const& {
|
||||
ASSERT(is_right(), "Tried to get right side of an either which is left.");
|
||||
return _right;
|
||||
}
|
||||
Right &right() & {
|
||||
return const_cast<Right&>(const_cast<const either<Left, Right>*>(this)->right());
|
||||
}
|
||||
Right &&right() && {
|
||||
return std::move(right());
|
||||
}
|
||||
|
||||
boost::optional<const Left&> left_opt() const& noexcept {
|
||||
if (_side == Side::left) {
|
||||
return _left;
|
||||
} else {
|
||||
return boost::none;
|
||||
template<typename Left, typename Right, typename... Args>
|
||||
inline either<Left, Right> make_right(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_right(std::forward<Args>(args)...))) */ {
|
||||
either<Left, Right> result(either<Left, Right>::Side::right);
|
||||
result._construct_right(std::forward<Args>(args)...);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
boost::optional<Left&> left_opt() & noexcept {
|
||||
if (_side == Side::left) {
|
||||
return _left;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
// warning: opposed to the other left_opt variants, this one already moves the content and returns by value.
|
||||
boost::optional<Left> left_opt() && noexcept(noexcept(boost::optional<Left>(std::move(_left)))) {
|
||||
if (_side == Side::left) {
|
||||
return std::move(_left);
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
boost::optional<const Right&> right_opt() const& noexcept {
|
||||
if (_side == Side::right) {
|
||||
return _right;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
boost::optional<Right&> right_opt() & noexcept {
|
||||
if (_side == Side::right) {
|
||||
return _right;
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
// warning: opposed to the other left_opt variants, this one already moves the content and returns by value.
|
||||
boost::optional<Right> right_opt() && noexcept(noexcept(boost::optional<Right>(std::move(_right)))) {
|
||||
if (_side == Side::right) {
|
||||
return std::move(_right);
|
||||
} else {
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
union {
|
||||
Left _left;
|
||||
Right _right;
|
||||
};
|
||||
enum class Side : uint8_t {left, right} _side;
|
||||
|
||||
explicit either(Side side) noexcept : _side(side) {}
|
||||
|
||||
template<typename... Args>
|
||||
void _construct_left(Args&&... args) noexcept(noexcept(new Left(std::forward<Args>(args)...))) {
|
||||
new(&_left)Left(std::forward<Args>(args)...);
|
||||
}
|
||||
template<typename... Args>
|
||||
void _construct_right(Args&&... args) noexcept(noexcept(new Right(std::forward<Args>(args)...))) {
|
||||
new(&_right)Right(std::forward<Args>(args)...);
|
||||
}
|
||||
void _destruct() noexcept {
|
||||
if (_side == Side::left) {
|
||||
_left.~Left();
|
||||
} else {
|
||||
_right.~Right();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Left_, typename Right_, typename... Args>
|
||||
friend either<Left_, Right_> make_left(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(std::forward<Args>(args)...))) */;
|
||||
|
||||
template<typename Left_, typename Right_, typename... Args>
|
||||
friend either<Left_, Right_> make_right(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_right(std::forward<Args>(args)...))) */;
|
||||
};
|
||||
|
||||
template<class Left, class Right>
|
||||
inline bool operator==(const either<Left, Right> &lhs, const either<Left, Right> &rhs) noexcept(noexcept(std::declval<Left>() == std::declval<Left>()) && noexcept(std::declval<Right>() == std::declval<Right>())) {
|
||||
if (lhs.is_left() != rhs.is_left()) {
|
||||
return false;
|
||||
}
|
||||
if (lhs.is_left()) {
|
||||
return lhs.left() == rhs.left();
|
||||
} else {
|
||||
return lhs.right() == rhs.right();
|
||||
}
|
||||
}
|
||||
|
||||
template<class Left, class Right>
|
||||
inline bool operator!=(const either<Left, Right> &lhs, const either<Left, Right> &rhs) noexcept(noexcept(operator==(lhs, rhs))) {
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
template<class Left, class Right>
|
||||
inline std::ostream &operator<<(std::ostream &stream, const either<Left, Right> &value) {
|
||||
if (value.is_left()) {
|
||||
stream << "Left(" << value.left() << ")";
|
||||
} else {
|
||||
stream << "Right(" << value.right() << ")";
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
template<typename Left, typename Right, typename... Args>
|
||||
inline either<Left, Right> make_left(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_left(std::forward<Args>(args)...))) */ {
|
||||
either<Left, Right> result(either<Left, Right>::Side::left);
|
||||
result._construct_left(std::forward<Args>(args)...);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename Left, typename Right, typename... Args>
|
||||
inline either<Left, Right> make_right(Args&&... args) /* TODO noexcept(noexcept(std::declval<either<Left, Right>>()._construct_right(std::forward<Args>(args)...))) */ {
|
||||
either<Left, Right> result(either<Left, Right>::Side::right);
|
||||
result._construct_right(std::forward<Args>(args)...);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user