3131namespace opdi {
3232
3333 struct Output {
34- private :
34+ protected :
3535
3636 // print functionality
3737
3838 template <typename First, typename ... Args>
39- static void printRec (First const & first, Args const &... args) {
40- std::cerr << first << " " ;
41- Output::printRec (args...);
39+ static void printRec (std::ostream& out, First const & first, Args const &... args) {
40+ out << first << " " ;
41+ Output::printRec (out, args...);
4242 }
4343
4444 template <typename Last>
45- static void printRec (Last const & last) {
46- std::cerr << last << std::endl;
45+ static void printRec (std::ostream& out, Last const & last) {
46+ out << last << std::endl;
4747 }
4848
4949 public:
@@ -63,14 +63,14 @@ namespace opdi {
6363 template <typename ... Args>
6464 static void print (Args const &... args) {
6565 omp_set_lock (&Output::lock);
66- Output::printRec (args...);
66+ Output::printRec (std::cerr, args...);
6767 omp_unset_lock (&Output::lock);
6868 }
6969
7070 template <typename ... Args>
7171 static void printThread (Args const &... args) {
7272 omp_set_lock (&Output::lock);
73- Output::printRec (" thread" , omp_get_thread_num (), args...);
73+ Output::printRec (std::cerr, " thread" , omp_get_thread_num (), args...);
7474 omp_unset_lock (&Output::lock);
7575 }
7676 };
0 commit comments