Substring class for basic_string

Hi
how I have complete the following code ?
I could not write function member

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
template<class Container>
Back_insert_iterator3<Container> backinserter3(Container &r)
{
    return Back_insert_iterator3<Container>(r);
}

template<class Ch>
class Basic_Substring{
public:
	typedef typename basic_string<Ch>::size_type size_type;
	Basic_Substring (basic_string<Ch> &s, size_type i, size_type n)İ // s[i]..s[i+n– 1]
	
	Basic_Substring (basic_string<Ch> &s  const (basic_string<Ch> &s2):ps(s), n(s2.length()) // s2 in s
	{
		pos = s.find(s2);
	}
	Basic_Substring (basic_string<Ch> &s, const Ch *p); // *p in s

	Basic_Substring &operator =(const basic_string<Ch> &s) // write through to *ps
	{
		ps->replace(pos, n, s);
		return *this;

	}
	Basic_Substring &operator =(const Basic_Substring<Ch> &s);
	Basic_Substring &operator =(const Ch *);
	Basic_Substring &operator =(Ch);
	operator basic_string<Ch>()const;  // read from *ps
	{
		return basic_string<Ch>(*ps, pos, n);
	}
	operator Ch*()const;

private:
	basic_string<Ch> *ps;
	size_type pos;
	size_type n;

};

Edit/Delete Message
Please see here and restate your "question": http://www.cplusplus.com/forum/articles/40071/#msg216269
1
2
3
4
5
6
7
8
9
Basic_Substring (basic_string<Ch> &s, size_type i, size_type n)İ // s[i]..s[i+n– 1]
Basic_Substring (basic_string<Ch> &s, const Ch *p); // *p in s



Basic_Substring &operator =(const Basic_Substring<Ch> &s);
Basic_Substring &operator =(const Ch *);
Basic_Substring &operator =(Ch);



How to I write this functions ?
I honestly don't think I know what it is you're trying to do. To overload the "=" operators you would set 's' equal to the object being referenced in the first one, I don't know what the other two are meant to do. There is too much missing from this class in your first post for me to just assume I know what is going on, I've tried that on other posts and I'm tired of looking like a dumb ass because of a misinterpreted description of the issue. There is also no context for me to go by, so as of yet I can not help you.
What is exactly wrong
Topic archived. No new replies allowed.