icecream-cpp icon indicating copy to clipboard operation
icecream-cpp copied to clipboard

Don't Cut on a Comma Within Curly Brackets

Open wongsingfo opened this issue 7 months ago • 0 comments

The existing code only considers () and <> for not cutting on a comma, but it does not handle {}.

Code Reference:

https://github.com/renatoGarcia/icecream-cpp/blob/29b8e8ab6447192629fadd248b226902f3c53cbf/icecream.hpp#L2666-L2691

Example:

#include <https://raw.githubusercontent.com/renatoGarcia/icecream-cpp/master/icecream.hpp>
#include <vector>

int main(int argc, char *argv[])
{
    std::vector<int> s = {{1,2,3,4,5,6,7}};

    IC( std::vector<int> { s.begin()+3, s.begin()+6 }, "hello");

    return 0;
}

Current Output:

ic| std::vector<int> { s.begin()+3: [4, 5, 6]
    s.begin()+6 }: ['h', 'e', 'l', 'l', 'o', '\0']

Expected Output:

ic| std::vector<int> { s.begin()+3, s.begin()+6 }: [4, 5, 6]
    "hello": ['h', 'e', 'l', 'l', 'o', '\0']

wongsingfo avatar Jul 24 '24 02:07 wongsingfo