axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools

Home Page:http://www.bento4.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C++ 20 support ?

alexbuisson opened this issue · comments

Is there a way to build with C++ 20 or do you have an update plan for that ?
template class like AP4_List and Array are not compile as is with C++20 standard.

I’ll take a look.

just add set(CMAKE_CXX_STANDARD 20) in CMakeLists.txt and build

gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC)

  • error: expected unqualified-id before ‘)’ token AP4_List(): m_ItemCount(0), m_Head(0), m_Tail(0) {}
  • error: template-id not allowed for destructor virtual ~AP4_List()
  • error: expected unqualified-id before ‘const’ AP4_List(const AP4_List&);
    etc ...

using C++20 it seems that using the notation in the definition is consider as an error
c++20-quick-fix.patch

I think it's a minimal patch tested with gc11 + vs2022 with C++ standard 11, 17 and 20
I'm a bit surprise that it didn't complain about

AP4_Array& operator=(const AP4_Array& copy);
and
AP4_List& operator=(const AP4_List&);

maybe those operator aren't really used so it doesn't trigger a compilation error !

The latest code should support C++ 20 with gcc now.
Please let me know if that works for you.