回答編集履歴

2

fix code

2015/10/08 15:07

投稿

yohhoy
yohhoy

スコア6189

test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  private:
30
30
 
31
- std::function<void()> callback_ = []{}
31
+ std::function<void()> callback_ = []{};
32
32
 
33
33
  };
34
34
 

1

よりC++11/14風に

2015/10/08 15:07

投稿

yohhoy
yohhoy

スコア6189

test CHANGED
@@ -10,9 +10,7 @@
10
10
 
11
11
  public:
12
12
 
13
- some_class()
13
+ some_class() = default;
14
-
15
- : callback_([]{}) {}
16
14
 
17
15
 
18
16
 
@@ -22,7 +20,7 @@
22
20
 
23
21
 
24
22
 
25
- ~some_class()
23
+ ~some_class() noexcept(false)
26
24
 
27
25
  { callback_(); }
28
26
 
@@ -30,7 +28,7 @@
30
28
 
31
29
  private:
32
30
 
33
- std::function<void()> callback_;
31
+ std::function<void()> callback_ = []{}
34
32
 
35
33
  };
36
34