title: C++ Arduino Vector issues with mismatched types?
body: <p>I've been trying to write some effects for a strip of RGB LEDs to be controlled via an Arduino Uno R3. For context, I'm working on the animation of a ball (a set of 5 LEDs) moving backwards and forward along the strip, bouncing from time to time.</p>
  <p>The vector causing issue is the <code>Colour</code> object, which I want to be a vector of CRGB colours which, when fewer than the number of colours available are passed to the function, it simply uses the first x amount but if there are more balls than there are colours then it should simply re-use them.</p>
  <p>Apologies if there are any errors in my formatting and such.</p>
  <p>The issue is when I try to pass the vectors as constructors to <code>BouncingBallEffect</code> it gives the following error:</p>
  <pre><code>[File-Path]\sketch_jul20b\sketch_jul20b.ino: In constructor 'BouncingBallEffect::BouncingBallEffect(size_t, size_t, byte, bool)':
  sketch_jul20b:44:28: error: no matching function for call to 'Vector&lt;double&gt;::Vector(size_t&amp;)'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template&lt;unsigned int MAX_SIZE&gt; Vector&lt;T&gt;::Vector(T (&amp;)[MAX_SIZE], size_t)
     Vector(T (&amp;values)[MAX_SIZE],
     ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note:   template argument deduction/substitution failed:
  [File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note:   mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
                   from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector&lt;T&gt;::Vector() [with T = double]
   Vector&lt;T&gt;::Vector()
   ^~~~~~~~~
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note:   candidate expects 0 arguments, 1 provided
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(const Vector&lt;double&gt;&amp;)
   class Vector
         ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector&lt;double&gt;&amp;'
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(Vector&lt;double&gt;&amp;&amp;)
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector&lt;double&gt;&amp;&amp;'
  sketch_jul20b:44:28: error: no matching function for call to 'Vector&lt;double&gt;::Vector(size_t&amp;)'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template&lt;unsigned int MAX_SIZE&gt; Vector&lt;T&gt;::Vector(T (&amp;)[MAX_SIZE], size_t)
     Vector(T (&amp;values)[MAX_SIZE],
     ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note:   template argument deduction/substitution failed:
  [File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note:   mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
                   from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector&lt;T&gt;::Vector() [with T = double]
   Vector&lt;T&gt;::Vector()
   ^~~~~~~~~
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note:   candidate expects 0 arguments, 1 provided
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(const Vector&lt;double&gt;&amp;)
   class Vector
         ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector&lt;double&gt;&amp;'
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(Vector&lt;double&gt;&amp;&amp;)
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector&lt;double&gt;&amp;&amp;'
  sketch_jul20b:44:28: error: no matching function for call to 'Vector&lt;double&gt;::Vector(size_t&amp;)'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template&lt;unsigned int MAX_SIZE&gt; Vector&lt;T&gt;::Vector(T (&amp;)[MAX_SIZE], size_t)
     Vector(T (&amp;values)[MAX_SIZE],
     ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note:   template argument deduction/substitution failed:
  [File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note:   mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
                   from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector&lt;T&gt;::Vector() [with T = double]
   Vector&lt;T&gt;::Vector()
   ^~~~~~~~~
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note:   candidate expects 0 arguments, 1 provided
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(const Vector&lt;double&gt;&amp;)
   class Vector
         ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector&lt;double&gt;&amp;'
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(Vector&lt;double&gt;&amp;&amp;)
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector&lt;double&gt;&amp;&amp;'
  sketch_jul20b:44:28: error: no matching function for call to 'Vector&lt;double&gt;::Vector(size_t&amp;)'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template&lt;unsigned int MAX_SIZE&gt; Vector&lt;T&gt;::Vector(T (&amp;)[MAX_SIZE], size_t)
     Vector(T (&amp;values)[MAX_SIZE],
     ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note:   template argument deduction/substitution failed:
  [File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note:   mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
                   from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector&lt;T&gt;::Vector() [with T = double]
   Vector&lt;T&gt;::Vector()
   ^~~~~~~~~
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note:   candidate expects 0 arguments, 1 provided
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(const Vector&lt;double&gt;&amp;)
   class Vector
         ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector&lt;double&gt;&amp;'
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;double&gt;::Vector(Vector&lt;double&gt;&amp;&amp;)
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector&lt;double&gt;&amp;&amp;'
  sketch_jul20b:44:28: error: no matching function for call to 'Vector&lt;CRGB&gt;::Vector(size_t&amp;)'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template&lt;unsigned int MAX_SIZE&gt; Vector&lt;T&gt;::Vector(T (&amp;)[MAX_SIZE], size_t)
     Vector(T (&amp;values)[MAX_SIZE],
     ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:24:3: note:   template argument deduction/substitution failed:
  [File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note:   mismatched types 'CRGB [MAX_SIZE]' and 'size_t {aka unsigned int}'
             Colours(ballCount)
                              ^
  In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
                   from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector&lt;T&gt;::Vector() [with T = CRGB]
   Vector&lt;T&gt;::Vector()
   ^~~~~~~~~
  [File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note:   candidate expects 0 arguments, 1 provided
  In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;CRGB&gt;::Vector(const Vector&lt;CRGB&gt;&amp;)
   class Vector
         ^~~~~~
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector&lt;CRGB&gt;&amp;'
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector&lt;CRGB&gt;::Vector(Vector&lt;CRGB&gt;&amp;&amp;)
  [File-Path]\Vector-1.2.1\src/Vector.h:19:7: note:   no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector&lt;CRGB&gt;&amp;&amp;'
  </code></pre>
  <p>My code is here:</p>
  <pre><code>#include &lt;Arduino.h&gt;
  #define FASTLED_INTERNAL
  #include &lt;FastLED.h&gt;
  
  using namespace std;
  #include &lt;Vector.h&gt;
  
  static const CRGB ballColours [] = {
      CRGB::Green,
      CRGB::Red,
      CRGB::Blue,
      CRGB::Orange,
      CRGB::Indigo
  };
  
  class BouncingBallEffect {
    private:
  
      double InitialBallSpeed(double height) const {
          return sqrt(-2 * Gravity * height);         // Because MATH!
      }
  
      size_t  _cLength;           
      size_t  _cBalls;
      byte    _fadeRate;
      bool    _bMirrored;
  
      const double Gravity = -9.81;                   // Because PHYSICS!
      const double StartHeight = 1;                   // Drop balls from max height initially
  
      Vector&lt;double&gt; ClockTimeAtLastBounce, Height, BallSpeed, Dampening;
      Vector&lt;CRGB&gt;   Colours;
  
    public:
  
      // BouncingBallEffect
      //
      // Caller specs strip length, number of balls, persistence level (255 is least), and whether the
      // balls should be drawn mirrored from each side.
  
      BouncingBallEffect(size_t cLength, size_t ballCount = 3, byte fade = 0, bool bMirrored = false)
          : _cLength(cLength - 1),
            _cBalls(ballCount),
            _fadeRate(fade),
            _bMirrored(bMirrored),
            ClockTimeAtLastBounce(ballCount),
            Height(ballCount),
            BallSpeed(ballCount),
            Dampening(ballCount),
            Colours(ballCount)
      {
          for (size_t i = 0; i &lt; ballCount; i++) {
              Height[i]                = StartHeight;                 // Current Ball Height
              Dampening[i]             = 0.90 - i / pow(_cBalls, 2);  // Bounciness of this ball
              BallSpeed[i]             = InitialBallSpeed(Height[i]); // Don't dampen initial launch
          }
      }
  };
  </code></pre>
  <p>Any help anyone can offer would be much appreciated, thank you.</p>