-2

i have a easy struct

struct Test {
  std::vector<int> values;
  int value;
}

with overloaded << operator

inline std::ostream& operator<<(std::ostream& p, const Test& t)
{
    p << "test: ";
    for(size_t i = 0; i < t.values.size(); i++) {
        std::cout << t.values[i] << " ";
    }
    p << " value: " << t.value << std::endl;
    return p;
}

this works fine when i use the default output. But when i am using my boost logge, shown here Different boost log sinks for every class, it print the values inside my console and the rest inside my file. Anyone has an idea what happens there?

Community
  • 1
  • 1
Hunk
  • 479
  • 11
  • 33

1 Answers1

4
std::cout << t.values[i] << " ";

should be

p << t.values[i] << " ";
jasal
  • 1,044
  • 6
  • 14