i create the read(...) function for read to variables.
but i need too the read()(without arguments) for press enter before continue\exit.

void read()
    {
        //wait if the enter key is pressed:
        cin.ignore();
        cin.get();
    }

    template<typename first_t, typename... rest_t>
    void read(first_t &first, rest_t... rest)
    {
        std::cin >> first;
        read(rest...); //function is recursive
                        //when the parameter pack becomes empty
                        //read(); will be called with no parameters
                        //which is why we declare it above
    }

    void read(string &parameter)
    {
        std::getline (std::cin,parameter);
    }

    void read(char *parameter)
    {
        cin.getline (parameter, 256);
    }

read();

the problem is that i need press, 2 times, the enter for exit...
why these happens?

What I'm reading is line 11 gets something, line 12 gets something. That's two "get something"s.

but that read() don't use arguments... i don't know control that.
i'm using C++14..
(for use C++17, i must change several code)
what you can advice me more about variadic templates?

  • the read() without parameters is for press enter key;
  • the read(....) with parameters is for read variables.

i even tried these:

void read()
    {
        cin.get();
    }

    template<typename first_t>
    void read(first_t arg)
    {
        cin>>arg;
    }

    template <typename first_t, typename... T >
    void read(first_t starg, T... args )
    {
        read(args...);
    }

i must press enter\return twices :(
what i'm doing wrong on read() (no arguments)?

"Luke, follow the code." As I read your code it looks to me that there are two input calls being made. Your code appears to do exactly what you wrote.

so why, on Code Blocks, exe(after compile), i press just once the return key... but the exe created with Command Line, must use twices?
i can share the 2 exe(if the moderator let me) for you see

maybe it's possible fix in a different way: can i get the template count parameters?
maybe the read(...) can be called instead the read()

This could be a side effect of your other changes. Such as different .h files? Why not run the code in some debugger so you can trace the code. OR do the old fashioned print or cout to see where your code goes. Sort of reminds me of Dr. Seuss, "Oh the places your code will go!"

finally i found my real problem.
after create the cpp file, the compiler call the header close to the cpp file because of:

#include "Untitled1.h"

i was changing the header file.. but these wasn't changed...
after i copy-paste the file, the problem was fixed.
you have right.. i must change the folder name for not get more surprisers on future.
i'm sorry something and thank you so much for all

Never worry about asking questions. I don't want to get into what are bad questions.

1st now the mail notification was fastter(maybe something was fixed or something) ;)
happy christmas and happy a new year and thank you so much for all

the last function, i belive, have a memory leak... so heres the new one

void read()
{
    //wait if the eneter key is pressed:
    cin.get();
}

template<typename first_t, typename... rest_t>
void read(first_t &first, rest_t... rest)
{
    std::cin >> first;
    read(rest...); //function is recursive
                    //when the parameter pack becomes empty
                    //read(); will be called with no parameters
                    //which is why we declare it above
}

void read(string &parameter)
{
    std::getline (std::cin,parameter);
}

void read(char *parameter)
{
    cin.getline (parameter, 256);
}

by the way: heres the write:

void write()
{
    //nothing
}

template<typename first_t, typename... rest_t>
void write(const first_t &first, const rest_t... rest)
{
    std::cout << first;

    write(rest...); //function is recursive
                    //when the parameter pack becomes empty
                    //write(); will be called with no parameters
                    //which is why we declare it above
}