Code Monkey home page Code Monkey logo

concat's People

Contributors

theypsilon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

concat's Issues

Can't pass std::endl as parameter

concat(1,2,3,std::endl); // error: requires 3 arguments, but 4 were provided

It looks like is not possible to infer between the char version of std::endl and wchar_t, and therefore it displays that weird error message. Because a parameter pack is used in order to allow variadic parameters with perfect forwarding, I see no way to help the compailer to infer the std::endl type in a arbitrary position of the parameter list.

std::ostream& (*s)(std::ostream&) = std::endl;
std::cout << concat(1,2,3, s);

works as expected, but doesn't feel right.

Possible enhancment: sequence delimiters

So now that std::pair is supported, it would be great to be able to have different delimiters at the start/end of sequences in addition to between the elements of a sequence, so a list of tuples might be rendered like:

(1, 2, 3), (3, 2, 1), ....

Otherwise there's no way to distinguish this:

list<int> ints ({1, 2, 3, 4, 5, 6})
cout << concat (separator (","), ints) << "\n";

from this:

list<pair<int, int>> pairs ({{1, 2}, {3, 4}, {5, 6});
cout << concat (separator (","), pairs) << "\n";

I think you're trying to keep things simple, so perhaps this is a feature too far.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.