pcsx2 icon indicating copy to clipboard operation
pcsx2 copied to clipboard

Common: Add ArrayRef and use it for GL::Context

Open TellowKrinkle opened this issue 3 years ago • 2 comments

Description of Changes

  • Adds LLVM's ArrayRef to Common
  • Switches GL::Context's pointer + length usage to ArrayRef

Rationale behind Changes

  • Can use C++ iteration now
  • The length of the return of GL::Context::GetAllVersionsList is no longer part of its type

Suggested Testing Steps

Launch the emulator with a GL backend

TellowKrinkle avatar Jan 10 '22 06:01 TellowKrinkle

There is also std::span/gsl::span, from what I can see by briefly looking into this code they are equivalent? https://github.com/microsoft/GSL/blob/main/include/gsl/span

std::span is C++20 so that might be a dealbreaker, but I think gsl::span has an identical API so that'd make potential future migration simplistic.

EDIT: gsl::span also has bounds checks: https://github.com/microsoft/GSL/wiki/gsl::span-and-std::span

CookiePLMonster avatar Jan 11 '22 08:01 CookiePLMonster

Switched to gsl

TellowKrinkle avatar Jan 12 '22 01:01 TellowKrinkle