OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

Using span and string_view instead of raw pointers

Open lgritz opened this issue 1 year ago • 0 comments

This task is to scrub the major APIs and eliminate as many places (as is practical, we know some may be harder than others) where we have API calls that take a pointer and size (or worse -- just a pointer and an assumption about the size), and instead use span<T>/cspan<T> for things that are like arrays, and string_view for things that are like strings.

For calls falling into this category, we'll have to decide on a case-by-case basis whether to (a) add a new variety of the call that takes a span, deprecating the old one, (b) replace the old one entirely.

Just as a way to seed you with ideas, and since this work can be parallelized by different people taking different classes, here is a list of some headers that probably contain functions that could use this cleanup:

  • [ ] argparse.h
  • [ ] deepdata.h
  • [ ] imagebuf.h
  • [ ] imagebufalgo.h
  • [ ] imagecache.h
  • [ ] imageio.h
  • [ ] paramlist.h
  • [ ] strutil.h
  • [ ] texture.h

lgritz avatar Feb 19 '24 23:02 lgritz