Skip to content

CTAD issue using frozen::map #26

Description

@Randalphwa

Migrated from the original repository
Original issue: serge-sans-paille/frozen#168
Originally reported by: @pfee


I'm unable to use class template argument deduction (CTAD) with frozen::map and frozen::unordered_map. I'm able to use it with std::map and std::unordered_map.

Is this a bug with the frozen library or an issue with my code?

#include <frozen/set.h>
#include <frozen/map.h>
#include <cstdint> // pmh.h missing include fixed after 1.1.1 was released.
#include <frozen/unordered_map.h>
#include <string_view>
#include <set>
#include <map>
#include <unordered_map>

using namespace std::literals;

int main()
{
    std::set a = {"one"sv, "two"sv};
    frozen::set b = {"one"sv, "two"sv};
    std::map c = {std::pair{"one"sv, 1}, std::pair{"two"sv, 2}};
    // frozen::map d = {std::pair{"one"sv, 1}, std::pair{"two"sv, 2}}; // Compilation error
    std::unordered_map e = {std::pair{"one"sv, 1}, std::pair{"two"sv, 2}};
    // frozen::unordered_map f = {std::pair{"one"sv, 1}, std::pair{"two"sv, 2}}; // Compilation error
    return 0;
}

I've tried compiling with v1.1.1 and with the latest (7e79c375b0) from git. Both fail in the same way.

Environment:

  • openSUSE Tumbleweed
  • GCC 13.2.1
  • C++17

My primary reason for wanting to use CTAD is to avoid having to specify the size of the container, which can be awkward with large datasets.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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