Skip to content

Commit

Permalink
Merge pull request #9 from SGSSGene/fix/improved_cpp_code
Browse files Browse the repository at this point in the history
Fix/improved cpp code
  • Loading branch information
SGSSGene authored Oct 27, 2023
2 parents 5afe15d + 9bf9976 commit 9c34229
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ CXXFLAGS += -Werror -Wextra -Wall

cwl_v1_2.h: FORCE
schema-salad-tool --codegen cpp \
--codegen-spdx-copyright-text "Copyright 2016-2023 CWL Project Contributors" \
--codegen-spdx-license-identifier "Apache-2.0" \
https://github.com/common-workflow-language/cwl-v1.2/raw/1.2.1_proposed/CommonWorkflowLanguage.yml \
> $@

Expand Down
26 changes: 15 additions & 11 deletions cwl_v1_2.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2016-2023 CWL Project Contributors
// SPDX-License-Identifier: Apache-2.0
#pragma once

/* This file was generated using schema-salad code generator.
Expand Down Expand Up @@ -172,24 +174,26 @@ class heap_object {
heap_object(heap_object const& oth) {
*data = *oth;
}
heap_object(heap_object&& oth) {
*data = *oth;
heap_object(heap_object&& oth) noexcept(noexcept(*data = std::move(*oth))) {
*data = std::move(*oth);
}

template <typename T2>
heap_object(T2 const& oth) {
*data = oth;
}
template <typename T2>
heap_object(T2&& oth) {
*data = oth;
heap_object(T2&& oth) noexcept(noexcept(*data = std::forward<T2>(oth))) {
*data = std::forward<T2>(oth);
}

~heap_object() = default;

auto operator=(heap_object const& oth) -> heap_object& {
*data = *oth;
return *this;
}
auto operator=(heap_object&& oth) -> heap_object& {
auto operator=(heap_object&& oth) noexcept(noexcept(*data = std::move(*oth))) -> heap_object& {
*data = std::move(*oth);
return *this;
}
Expand All @@ -200,21 +204,21 @@ class heap_object {
return *this;
}
template <typename T2>
auto operator=(T2&& oth) -> heap_object& {
*data = std::move(oth);
auto operator=(T2&& oth) noexcept(noexcept(*data = std::forward<T2>(oth))) -> heap_object& {
*data = std::forward<T2>(oth);
return *this;
}

auto operator->() -> T* {
auto operator->() noexcept(true) -> T* {
return data.get();
}
auto operator->() const -> T const* {
auto operator->() const noexcept(true) -> T const* {
return data.get();
}
auto operator*() -> T& {
auto operator*() noexcept(true) -> T& {
return *data;
}
auto operator*() const -> T const& {
auto operator*() const noexcept(true) -> T const& {
return *data;
}
};
Expand Down

0 comments on commit 9c34229

Please sign in to comment.