I have a question for my fellow plugin developers. I’m working on some code I hope to make as reusable as possible for Sapphire (and maybe other projects too).
I have some C++ templates that look like this:
template <typename real_t, typename item_t, typename deriv_proc_t>
class ListSimulator
: public Simulator<real_t, std::vector<item_t>, deriv_proc_t, ListAdd<item_t>, ListMul<item_t, real_t>>
{
public:
ListSimulator(deriv_proc_t deriv, std::size_t itemCount)
: Simulator<real_t, std::vector<item_t>, deriv_proc_t, ListAdd<item_t>, ListMul<item_t, real_t>>(
deriv, ListAdd<item_t>(), ListMul<item_t, real_t>())
{
this->resize(itemCount);
}
};
This exact code isn’t important. I’m focusing on how you supply the type parameter real_t, and it assumes that your lists are of type std::vector<real_t>.
I’m interesting in using std::span<real_t> instead in my API, to allow for more flexible use cases for operating on lists of things, but not assuming they have to be stored in a std::vector specifically. For example, what if the caller wants to store them in a std::array instead? The span type is supposed to handle both cases as a non-owning contiguous range of items.
The only problem is, spans are not supported until C++20. The Sapphire project uses C++17. A conversation with Microsoft Copilot suggested using the Boost library, and that the license allows me to include their code in my GPLv3+ project so long as I also include a copy of their license. Apparently boost::span was the basis for the C++20 std::span anyway.
Whether or not spans are actually a good idea for my use case remains to be seen, and I’m not really interested in that topic now because it will get in the weeds very quickly, because I haven’t explained all the complexities of my goals. So I’m not asking for help about that!
I just wanted to see if anyone else is using Boost for their VCV Rack plugin, and if you have run into any issues, whether technical or legal.
Thanks in advance for any helpful info!