Converting from `std::array<std::variant<>>` to `void*`

I’m doing some work with Vulkan, in this I need to pass a set of values of various types.

Currently I’m using std::array<std::variant<>> in my interface, but I must pass Vulkan a void*.

To convert to the void* I use this function:

template <uint32_t Size>
void* voidArray(std::array<std::variant<uint32_t,float>,Size>& array, uint32_t size) {
    char* bytes = new char(size);
    uint32_t byteCounter = 0;
    for(uint32_t i=0;i<array.size();++i) {
        if(float* flt = std::get_if<float>(&array(i))) {
            *reinterpret_cast<float*>(bytes+byteCounter) = *flt;
            byteCounter += sizeof(float);
        }
        else if(uint32_t* uin = std::get_if<uint32_t>(&array(i))) {
            *reinterpret_cast<uint32_t*>(bytes+byteCounter) = *uin;
            byteCounter += sizeof(uint32_t);
        }
    }
    void* data = static_cast<void*>(bytes);
    return data;
}

I get the size variable earlier within a larger function (names are a little more context specific):

// std::array<std::variant<uint32_t,float>,NumPushConstants>& pushConstants
std::optional<uint32_t> pushConstantSize = std::nullopt;
auto size_fn = ()(auto variant) -> uint32_t {
    using T = std::decay_t<decltype(variant)>;
    if constexpr (std::is_same_v<uint32_t, T>) { return sizeof(uint32_t); }
    if constexpr (std::is_same_v<float, T>) { return sizeof(float);}
};
pushConstantSize = std::accumulate(pushConstants.begin(),pushConstants.end(),0,
    (size_fn)(uint32_t acc, auto variant) { return std::move(acc) + std::visit(size_fn,variant); }
);

Both of these implementations, most prominently the first rouse my suspicion of being bad.

Are they bad? Is there a better way? Am I missing something?