Hallo zusammen,
ich würde gerne std::async() in Verbindung mit Parametern nutzen, die 
ein Alignment brauchen. Beispiel:
1  | #include <future>         // std::async, std::future
  | 
2  | 
  | 
3  | // 16 byte aligned class (VS C++ syntax)
  | 
4  | __declspec(align(16)) 
  | 
5  | class C {
 | 
6  | };
  | 
7  | 
  | 
8  | // dummy
  | 
9  | bool func(C c)
  | 
10  | // bool func(const C& c) // funktioniert auch nicht
  | 
11  | {
 | 
12  |   return true;
  | 
13  | }
  | 
14  | 
  | 
15  | int main()
  | 
16  | {
 | 
17  |   // call func asynchronously:
  | 
18  |   std::future<bool> fut = std::async(func, C());
  | 
19  | 
  | 
20  |   fut.get();      // waits for func to return
  | 
21  | }
  | 
Nun gibt mir der Compiler (VS C++ 2015) den Fehler aus:
1  | Error C2719 'c': formal parameter with requested alignment of 16 won't be aligned
  | 
Dabei ist es egal, ob func() das C direkt oder als const reference 
nimmt. Ich nehme an, dass intern ein Lambda-Ausdruck benutzt wird, um 
den Aufruf "zwischenzuspeichern" und dabei das Alignment verloren geht.
Gibt es da Abhilfe?
BTW: eigentlich nutze ich nicht direkt std::async() sondern eine eigene, 
ähnliche Implementierung, die das Problem ebenfalls hat.
Lieben Gruß