allow tokenizing string_view to string_view(s)

Open
#15 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start by locating assign_or_plus_equal and the tokenizer paths that handle string_view, then compare their current dependence on std::string::assign with the proposed specialization. Done means tokenizing into std::basic_string_view works without relying on std::string's assign function and the existing tokenizer behavior remains intact.

Written by the indexing model from the issue text.

Description

This requires getting around the dependency on std::string's assign function. I added the following specialization to assign_or_plus_equal to get it working but it could probably be done better.

    template<class Iterator, typename char_t>
    static void assign(Iterator b, Iterator e, std::basic_string_view<char_t>& t)
    {
        t = { std::addressof(*b), static_cast<size_t>(std::distance(b, e)) };
    }
Dominant language
C++
Stars
30
Forks
45
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/tokenizer

All issues in boostorg/tokenizer

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.