# dsp::AudioBlock::copyFrom with SIMD types

**URL:** <https://forum.juce.com/t/dsp-copyfrom-with-simd-types/48210>\
**Category:** General JUCE discussion\
**Created:** [October 12, 2021, 7:42am UTC](https://forum.juce.com/t/dsp-copyfrom-with-simd-types/48210 "2021-10-12T07:42:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jchowdhury18](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@jchowdhury18](https://forum.juce.com/u/jchowdhury18)\
**Post date:** [October 12, 2021, 7:42am UTC](https://forum.juce.com/t/dsp-copyfrom-with-simd-types/48210/1 "2021-10-12T07:42:05Z")

</div>

`dsp::AudioBlock` is really great since nearly everything I want to do with it works the same for SIMD data types as it does for scalar types. One notable exception is the `copyFrom()` function. Quite often, I run into a situation like this:

```cpp
template <typename SampleType>
class MyProcessor
{
    ...
    template <typename ProcessContext, Type type>
    void process (const ProcessContext& context) noexcept
    {
        const auto& inputBlock = context.getInputBlock();
        auto& outputBlock = context.getOutputBlock();

        if (context.isBypassed)
        {
            outputBlock.copyFrom (inputBlock);
            return;
        }
        ...
    }
};

```

Then, if I try to use an instance of `MyProcessor<dsp::SIMDRegister<float>>`, I end up with an error like this:

```auto
JUCE\modules\juce_dsp\containers/juce_AudioBlock.h(592,1) error C2440: 'reinterpret_cast': cannot convert from 'SampleType *' to 'float *'
           with
           [
               SampleType=const juce::dsp::SIMDRegister<float>
           ]

```

For now I’ve implemented my own copy operation as a work-around, but it would really nice if `copyFrom()` just worked out-of-the-box.
