Skip to content

Commit 2eaaef5

Browse files
committed
ossia::to_value: enforce types
1 parent da8fba0 commit 2eaaef5

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

include/avnd/binding/ossia/to_value.hpp

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,31 @@ struct to_ossia_value_impl
165165
val = std::move(v);
166166
}
167167

168+
void operator()(const std::array<int, 2>& f)
169+
{
170+
val = std::vector<ossia::value>{f[0], f[1]};
171+
}
172+
void operator()(const std::array<int, 3>& f)
173+
{
174+
val = std::vector<ossia::value>{f[0], f[1], f[2]};
175+
}
176+
void operator()(const std::array<int, 4>& f)
177+
{
178+
val = std::vector<ossia::value>{f[0], f[1], f[2], f[3]};
179+
}
180+
void operator()(const std::array<int64_t, 2>& f)
181+
{
182+
val = std::vector<ossia::value>{(int)f[0], (int)f[1]};
183+
}
184+
void operator()(const std::array<int64_t, 3>& f)
185+
{
186+
val = std::vector<ossia::value>{(int)f[0], (int)f[1], (int)f[2]};
187+
}
188+
void operator()(const std::array<int64_t, 4>& f)
189+
{
190+
val = std::vector<ossia::value>{(int)f[0], (int)f[1], (int)f[2], (int)f[3]};
191+
}
192+
168193
void operator()(const std::array<float, 2>& f) { val = f; }
169194
void operator()(const std::array<float, 3>& f) { val = f; }
170195
void operator()(const std::array<float, 4>& f) { val = f; }
@@ -436,11 +461,11 @@ ossia::value to_ossia_value(const avnd::bitset_ish auto& v)
436461

437462
ossia::value to_ossia_value(const std::integral auto& v)
438463
{
439-
return v;
464+
return (int)v;
440465
}
441466
ossia::value to_ossia_value(const std::floating_point auto& v)
442467
{
443-
return v;
468+
return (float)v;
444469
}
445470
ossia::value to_ossia_value(const avnd::variant_ish auto& v)
446471
{

0 commit comments

Comments
 (0)