Skip to main content
53 votes
2 answers
3k views

If in a C++ program, I activate upward rounding mode for floating-point numbers and print some double-precision value already rounded to an integer, e.g.: #include <cfenv> #include <iostream&...
Fedor's user avatar
  • 24.7k
0 votes
1 answer
122 views

I get this error even though I overloaded the << operator. My prototype is as follows, placed within the Fraction class header file. friend std::ostream& operator << (std::ostream&,...
Tyler Pruden Jin2188's user avatar
1 vote
2 answers
113 views

This is the brute-force inelegant mechanism that illustrates what I could do (likely done with MACROS in the end): void myFunction(std::ostream& _log) { int threshold = 100; ... if (...
Lance E.T. Compte's user avatar
-1 votes
2 answers
112 views

Motivation for this question: the C++ API to Google's Protobuf serializes its messages into ostream: bool SerializeToOstream(ostream* output) const;: writes the message to the given C++ ostream. ...
Tarmo's user avatar
  • 5,015
2 votes
1 answer
67 views

Is there a way to extract iostate (goodbit,badbit, failbit) or other means of error state of a std::ostream when I access this std::ostream through a std::osyncstream. I would like to detect whether ...
kfpgk's user avatar
  • 85
-2 votes
2 answers
93 views

Can someone explain why the << operator cannot be found when it's in the global namespace? Also, why might it be a problem if it could be? #include <ostream> #include <iostream> ...
jozxyqk's user avatar
  • 17.7k
1 vote
1 answer
120 views

I have a simplified analogue of netgen in C++. In one pipeline, I need to output to a file the coordinates of those nodes (as a container std::array of three elements) that fall inside a sphere of a ...
Fuhrer_BMSTU's user avatar
0 votes
1 answer
108 views

I'm having trouble passing a reference to std::ostream to a class constructor and assigning it to a reference member variable. I have two files: // ./include/HelloWorld.hpp #ifndef __HELLOWORLD_H__ #...
d.lanza38's user avatar
  • 2,657
0 votes
1 answer
100 views

I output my class objects using cout or ofstream. I understood that the insertion operator << is the standard way to convert an object to a string or print it. I would like to use different ...
elehtine's user avatar
  • 108
0 votes
1 answer
172 views

I wouldn't have this problem if I put the class code in the same header or same .cpp file, but when I have the class specification in the header and the class code in a separate .cpp file, I get this ...
Agent 47's user avatar
-1 votes
2 answers
67 views

I have written my own operator<< implementation in my Logger class: #pragma once #include <map> #include <vector> #include <string> class Logger { public: enum Severity ...
binaryBigInt's user avatar
  • 1,724
0 votes
0 answers
23 views

enter image description here i tried to used operator istream and ostream but it doesn't work. I'm writing a HinhTron class from the existing Diem2D class to use point coordinates from the 2D class. ...
bazzi's user avatar
  • 1
3 votes
0 answers
136 views

As a university assignment I have to implement the ostream class of C++ standard library. I have header files with the function declarations and .cpp files, where I have to implement the functions ...
r3k0j's user avatar
  • 187
0 votes
4 answers
213 views

For example, if I wanted to have a default version of outputting with << and a detailed version. myClass myObject(//Constructor parameters); cout << myObject << "\n"; cout ...
Blockt's user avatar
  • 45
-2 votes
3 answers
125 views

I have a class of shapes, it works on the principle that a shape consists of points (x and y coordinates). But overloading the input and output operators I encountered a problem that could serve as an ...
keinpop's user avatar

15 30 50 per page
1
2 3 4 5
52