fix bugs in static_variant
This commit is contained in:
parent
0caac3fee9
commit
3a120c0f7f
1 changed files with 3 additions and 2 deletions
|
|
@ -80,7 +80,7 @@ struct storage_ops<N, T, Ts...> {
|
|||
}
|
||||
static void con(int n, void *data) {
|
||||
if(n == N) new(reinterpret_cast<T*>(data)) T();
|
||||
else storage_ops<N + 1, Ts...>::del(n, data);
|
||||
else storage_ops<N + 1, Ts...>::con(n, data);
|
||||
}
|
||||
|
||||
template<typename visitor>
|
||||
|
|
@ -316,6 +316,7 @@ public:
|
|||
|
||||
void set_which( int w ) {
|
||||
this->~static_variant();
|
||||
_tag = w;
|
||||
impl::storage_ops<0, Types...>::con(_tag, storage);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue