Skip to content

Commit

Permalink
Minor soapy cleanups (#433)
Browse files Browse the repository at this point in the history
* Avoid reference to stdlib function
  … which is unspecified (possibly ill-formed):
https://eel.is/c++draft/library#namespace.std-6

* Use std::tie instead of std::forward_as_tuple
  The former creates a tuple of lvalue references, the latter can
additionally hold rvalue references, which is not the intent here.

Signed-off-by: Matthias Kretz <[email protected]>
  • Loading branch information
mattkretz authored Oct 1, 2024
1 parent c9ef707 commit dad548e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blocks/soapy/include/gnuradio-4.0/soapy/Soapy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This block supports multiple output ports and was tested against the 'rtlsdr' an
using A = Annotated<U, description, Arguments...>; // optional shortening

using TimePoint = std::chrono::time_point<std::chrono::system_clock>;
using TSizeChecker = Limits<0U, std::numeric_limits<std::uint32_t>::max(), std::has_single_bit<std::uint32_t>>;
using TSizeChecker = Limits<0U, std::numeric_limits<std::uint32_t>::max(), [](std::uint32_t x) { return std::has_single_bit(x); }>;
using TBasePort = PortOut<T>;
using TPortType = std::conditional_t<nPorts == 1U, TBasePort, std::conditional_t<nPorts == std::dynamic_extent, std::vector<TBasePort>, std::array<TBasePort, nPorts>>>;

Expand Down
4 changes: 2 additions & 2 deletions blocks/soapy/include/gnuradio-4.0/soapy/SoapyRaiiWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,12 @@ class Device {
return SOAPY_SDR_TIMEOUT;
}
if constexpr (sizeof...(TBuffers) == 1UZ) {
auto&& buffer = std::get<0>(std::forward_as_tuple(ioBuffers...));
auto&& buffer = std::get<0>(std::tie(ioBuffers...));
void* ioBufferPointer = static_cast<void*>(buffer.data());
return SoapySDRDevice_readStream(_device.get(), _stream.get(), &ioBufferPointer, buffer.size(), &flags, &timeNs, static_cast<long>(timeOutUs));
} else {
std::array<void*, sizeof...(ioBuffers)> ioBufferPointers = {static_cast<void*>(ioBuffers.data())...};
return SoapySDRDevice_readStream(_device.get(), _stream.get(), ioBufferPointers.data(), std::get<0>(std::forward_as_tuple(ioBuffers...)).size(), &flags, &timeNs, timeOutUs);
return SoapySDRDevice_readStream(_device.get(), _stream.get(), ioBufferPointers.data(), std::get<0>(std::tie(ioBuffers...)).size(), &flags, &timeNs, timeOutUs);
}
}

Expand Down

0 comments on commit dad548e

Please sign in to comment.