下の本書のカバー画像をクリックするとサンプルファイルのダウンロードが始まります
(ファイル名:ue4cppbook_20180224.zip)
正誤情報:(2018年4月9日更新)
◉ 本書 P-27 Chapter2 2.2.2. 構造体
2行目の「値の変更はできないため、」を削除。
修正PDF
◉ 本書 P-114 Chapter5 5.6.2. 非同期処理を開始する関数
ParallelFor関数のコード例
以下のように修正します。
auto UAsyncTest::DoParallelForTest(const int32 Input) -> TArray<int32> {
TArray<int32> Results;
Results.Init(-1, Input); // (1)
ParallelFor(Input, // (2)
[&Results](int32 index) { // (3)
Results[index] = index * index;
});
return Results; // (5)
}
修正PDF
◉ 本書 P-115 Chapter5 5.6.2. 非同期処理を開始する関数
2行目 (4) すべてのタスクが終了して Results に値が入るまで待機します。を削除
修正PDF
◉ 本書 P-116 Chapter5 5.6.3. 非同期処理を補助するAPI
FScopeLockのコード例
以下のように修正します。
auto UAsyncTest::DoCriticalSectionTest(const int32 Input) -> int32 {
int32 Result = 0;
static FCriticalSection Section; // (1)
ParallelFor(Input,
[&Result](int32 index) {
for (int i = 0; i < 1000; i++) {
const auto sq = index * index;
{
FScopeLock Lock(&Section); // (2)
Result += sq;
}
}
});
return Result;
}
修正PDF
以上。