conversion std::stoi

Jul 30, 2014 at 10:27pm
closed account (EwCjE3v7)
I do not know how to put a explicit cast on this. Any ideas?

warning: overflow in implicit constant conversion [-Woverflow]


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef BIRTHDATE_H
#define BIRTHDATE_H

#include <iostream>
#include <string>

class Birthdate {
public:
	Birthdate() = default; // we need this
	Birthdate(std::string s) : Birthdate() {
		day = stoi(s.substr(s.find_first_of(1234567890)));
		std::cout << day;
	}


	unsigned day = 00, month = 00, year = 0000;
};

#endif 
Last edited on Jul 30, 2014 at 10:27pm
Jul 30, 2014 at 10:40pm
Think the error lies here: s.find_first_of(1234567890) http://www.cplusplus.com/reference/string/string/find_first_of/
Jul 31, 2014 at 10:58am
closed account (EwCjE3v7)
oh forgot the " "

Thank you ;D

Stupid me
Topic archived. No new replies allowed.