Skip to content

Commit

Permalink
warnings: Compiler warning on memset usage for non-trivial type
Browse files Browse the repository at this point in the history
Problem:
- IS_TRIVIALLY_CONSTRUCTIBLE macro does not work correctly resulting
  in `memset()` usage to set a non-trivial type to 0 when
  `nontrivial_t` is passed in from the tests.
- Warning reported by GCC when compiling with `--enable-werror`.

Solution:
- Use the standard algorithm `std::fill_n()` and let the compiler
  determine the optimal way of looping or using `memset()`.
  • Loading branch information
ldm5180 authored and random-zebra committed Dec 19, 2020
1 parent 4cb188e commit d856989
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/prevector.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <stdint.h>
#include <string.h>

#include <algorithm>
#include <cstddef>
#include <iterator>
#include <type_traits>

Expand Down

0 comments on commit d856989

Please sign in to comment.