Skip to content

Instantly share code, notes, and snippets.

@r-lyeh-archived
Created May 19, 2016 10:08
Show Gist options
  • Save r-lyeh-archived/b3c4b21fa19ccb683c944b87baca51e5 to your computer and use it in GitHub Desktop.
Save r-lyeh-archived/b3c4b21fa19ccb683c944b87baca51e5 to your computer and use it in GitHub Desktop.

Revisions

  1. @r-lyeh r-lyeh created this gist May 19, 2016.
    20 changes: 20 additions & 0 deletions use1st.cc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #include <string>
    #include <iostream>
    #include <utility>

    void internal_func(const std::string& s)
    {
    std::cout << s << '\n';
    }

    template <typename ... T>
    void do_with_string(T&& ... t)
    {
    internal_func({std::forward<T>(t)...});
    }

    int main()
    {
    do_with_string("foobar", 3U);
    do_with_string(std::string("bar"));
    }