Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Backward compatibility with C++11  #1357

@sreekants

Description

@sreekants

Issue

The 'Requirements' section of the documentation says:

_Generally, fastText builds on modern Mac OS and Linux distributions. Since it uses some C++11 features, it requires a compiler with good C++11 support. These include :

(g++-4.7.2 or newer) or (clang-3.3 or newer)_

Recent performance improvements use C++17 features (specifically the use of std::string_view). Reference issue - Predict 1.9-4.2x faster (#1341)

Action

Although C++17 is now a prerequisite, fastText can still compile on C++11 with a few minor modifications, but with degraded performance. To do this:

  • Dependency on string_view is restored using a type definition on C++11.
  • Fix build errors caused by use of static_assert
  • Add instructions in the README file for modifications to makefile to build on C++11

The feature is desirable because legacy systems that use fastText (since 2015) might continue to use C++11.

Recommendation

  • Add string_view to dictionary for fast lookup (commit ffee8e4) incorrectly replaces a pass by reference by a pass by value on several constant argument. Use a pass by reference instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions