Search code examples
android-ndklibstdc++libc++

Hashtable class is missing in llvm libc++


I am doing the migration of standard library in my Android projects from gnustl (libstdc++) to llvm-libc++. and in one of the project, I am getting multiple errors of the missing header file,

  fatal error: 'hashtable.h' file not found
#include "hashtable.h"
         ^~~~~~~~~~~~~
clang++.exe: error: clang frontend command failed due to signal (use -v to see invocation)
Android clang version 5.0.300080  (based on LLVM 5.0.300080)

Preprocessed file output revealed that this file is supplied by gnustl

.. f:/nugetcache/androidndk.16.1.1/sources/cxx-stl/gnu-libstdc++/4.9/include/backward\\hashtable.h

But after I have migrated to libc++ I could not find the equivalent header in libc++. This header file declares class HashTable

template<class _Val, class _Key, class _HashFcn,
       class _ExtractKey, class _EqualKey, class _Alloc>
    class hashtable
    {...}

I tried searching for this header and this class in libc++ code but could not find anything. I think this is an important class and must be provided by libc++ in some form but I could not identify it.

Has anyone faced error due to this discrepancy and what is the suggested work-around?


Solution

  • I tried searching for this header and this class in libc++ code but could not find anything. I think this is an important class and must be provided by libc++ in some form but I could not identify it.

    This is a libstdc++ extension, left over from pre-C++11 days.

    If you take a look at the contents here, you'll see that it has a comment at the top says: This is an internal header file, included by other library headers. Do not attempt to use it directly.