- CHAR_BIT is not eight - 1 Update
- static array of reference_wrapper - 1 Update
| Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>: Oct 15 03:42PM -0700 On Saturday, October 15, 2022 at 9:06:25 PM UTC+1, Chris M. Thomasson wrote: > Did you actually write the cipher? Or did you get the code from GitHub? I can't find an algorithm that will fit on the microcontroller so I'm writing my own. 99% of the program memory is already taken up. |
| Marcel Mueller <news.5.maazl@spamgourmet.org>: Oct 16 12:42AM +0200 Hi when I try to initialize a static array of references using reference_wrapper I get a compiler error: struct ColumnRenderer { // ... }; static const std::reference_wrapper<const ColumnRenderer> Renderers[] = { ColumnRenderer(), ColumnRenderer() }; conversion from 'ColumnRenderer' to non-scalar type 'std::reference_wrapper<const ColumnRenderer>' requested If I do the same with a simple custom reference wrapper it works: template <typename T> struct reference { T& Ref; constexpr reference(T& ref) : Ref(ref) { } constexpr operator T&() const { return Ref; } }; static const reference<const ColumnRenderer> Renderers[] = { ColumnRenderer(), ColumnRenderer() }; Why? I thought reference_wrapper is intended to be used with arrays. Or is this one of the blemishes of C++11 that has been fixed in later versions? Marcel |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment