Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

width() non-functional (for me) #28

Open
dougp2 opened this issue Jan 12, 2019 · 2 comments
Open

width() non-functional (for me) #28

dougp2 opened this issue Jan 12, 2019 · 2 comments

Comments

@dougp2
Copy link

dougp2 commented Jan 12, 2019

This code:
[code]
// width.cpp -- using the width method
// C++ primer 17.4, page 1080

#include <ArduinoSTL.h>
//#include <PrintStream.h>

void setup() {

Serial.begin(115200);

using std::cout;
int w = cout.width(30);
cout << "default field width = " << w << ":\n";

cout.width(5);
cout << "N" <<':';
cout.width(8);
cout << "N * N" << ":\n";

for (long i = 1; i <= 100; i *= 10)
{
    cout.width(5);
    cout << i <<':';
    cout.width(8);
    cout << i * i << ":\n";
}
// std::cin.get();

}[/code]

void loop() {}

is supposed to print right justified. It doesn't, everything on a line is jammed together.

Am I doing something wrong?

@kirkins
Copy link

kirkins commented Jan 19, 2019

I'm having a similar issue with accumulate:

'accumulate' is not a member of 'std'

Running as:

float average = std::accumulate(avgTemp.begin(), avgTemp.end(), 0.0)/avgTemp.size();

@mike-matera
Copy link
Owner

This seems to be a limitation of the underlying uClibc++ library. It looks like some of the functionality is implemented but it clearly doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants