teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

追加情報

2019/11/02 16:28

投稿

asobinin
asobinin

スコア69

title CHANGED
File without changes
body CHANGED
@@ -2,6 +2,16 @@
2
2
  試しにnone_options_property() : m_ref_value(a) { std::cout << "DEFAULT CONSTRUCTOR" << std::endl; }でテストしてみても、"DEFAULT CONSTRUCTOR"が表示されることはありませんでした。
3
3
  一体どの箇所でデフォルトコンストラクタが呼ばれてしまっているのでしょうか?
4
4
 
5
+ 実行環境:
6
+ OS Windows10 home
7
+ コンパイラ:
8
+ Visual Studio2019
9
+ エラー文 C2280 'asobi::detail::property_options<T,asobi::options::get,asobi::options::set>::property_options(void)': 削除された関数を参照しようとしています
10
+
11
+ GCC 8.2.0
12
+ エラー文(一部抜粋) In function 'int main()':
13
+ test.cpp:16:52: error: use of deleted function 'asobi::property<int, asobi::options::get, asobi::options::set>::property(int&) [inherited from asobi::detail::none_options_property<int>]'
14
+ asobi::property<int, GET_OP, SET_OP> value(m_value);
5
15
  ___
6
16
  コードが長くなってしまいますが、すべてのコントラスタはproperty_detail.hppの中の基底クラスであるnone_options_propertyのコントラスタを継承しています。
7
17
  ```Cpp
@@ -88,10 +98,10 @@
88
98
  public: // constructor, destructor
89
99
  using none_options_property<T>::none_options_property;
90
100
  public: // functions
101
+ inline auto& set(T&& value) { this->m_ref_value = std::move(value); return *this; }
91
102
  inline auto& set(const T& value) { this->m_ref_value = value; return *this; }
92
- inline auto& set(T&& value) { this->m_ref_value = std::move(value); return *this; }
103
+ inline auto& operator =(T&& value) { this->m_ref_value = std::move(value); return *this; }
93
104
  inline auto& operator =(const T& value) { this->m_ref_value = value; return *this; }
94
- inline auto& operator =(T&& value) { this->m_ref_value = std::move(value); return *this; }
95
105
  inline auto& operator +=(T&& value) { this->m_ref_value += value; return *this; }
96
106
  inline auto& operator +=(const T& value) { this->m_ref_value += value; return *this; }
97
107
  inline auto& operator -=(T&& value) { this->m_ref_value -= value; return *this; }