avatar
o*l
1
I download TCP/IP Test server 1.1.0.1, but it failed to install in XP.
It is a comprehensive testing tool that allows socket programmers to develop
client side applications that open sockets and communicate with this server.
Is there an alternative software which can run in XP, Win7, or Linux?
Thanks!
avatar
n*d
2
The code is from "Thinking C++ V1". I don't think line 15 will prevent
assignment. I defined a Dog which can be assigned (=) to another Dog. Any
comment?
1 //: C12:ReferenceCounting.cpp
2 // Reference count, copy-on-write
3 #include "../require.h"
4 #include
5 #include
6 using namespace std;
7 class Dog {
8 string nm;
9 int refcount;
10 Dog(const string& name)
11 : nm(name), refcount(1) {
12 cout << "Creating Dog: " << *this << endl;
13 }
14 // Prevent ass
avatar
t*r
3
LANTrafficV2
破解一下
avatar
b*n
4
google non-copyable

【在 n**d 的大作中提到】
: The code is from "Thinking C++ V1". I don't think line 15 will prevent
: assignment. I defined a Dog which can be assigned (=) to another Dog. Any
: comment?
: 1 //: C12:ReferenceCounting.cpp
: 2 // Reference count, copy-on-write
: 3 #include "../require.h"
: 4 #include
: 5 #include
: 6 using namespace std;
: 7 class Dog {

avatar
n*d
5
This is my testing code. You can see d3 = d1 works.
#include
#include
using namespace std;
class Dog {
string nm;
int refcount;
// Prevent assignment:
Dog& operator=(const Dog& rv);
public:
Dog(const string& name)
: nm(name), refcount(1) {
cout << "Creating Dog: " << *this << endl;
}
// Dogs can only be created on the heap:
static Dog* make(const string& name) {
return new Dog(name);
}
/*
Dog(const Dog& d)


【在 b********n 的大作中提到】
: google non-copyable
avatar
t*t
6
that's not "d3 = d1"
that's "Dog d3 = d1", which is roughly equivalent to "Dog d3(d1)"
to prevent that, you need to make copy constructor private
please read carefully

【在 n**d 的大作中提到】
: This is my testing code. You can see d3 = d1 works.
: #include
: #include
: using namespace std;
: class Dog {
: string nm;
: int refcount;
: // Prevent assignment:
: Dog& operator=(const Dog& rv);
: public:

avatar
n*d
7
Why is roughly, not exactly?

【在 t****t 的大作中提到】
: that's not "d3 = d1"
: that's "Dog d3 = d1", which is roughly equivalent to "Dog d3(d1)"
: to prevent that, you need to make copy constructor private
: please read carefully

avatar
t*t
8
they have some subtle difference which is not frequently used. i suggest you
take it for now.
otherwise you can search my previous post for the difference...

【在 n**d 的大作中提到】
: Why is roughly, not exactly?
avatar
n*d
9

you
Do you mean to think they are the same for now
Give me a hint how to search your previous post.

【在 t****t 的大作中提到】
: they have some subtle difference which is not frequently used. i suggest you
: take it for now.
: otherwise you can search my previous post for the difference...

avatar
k*f
10
Try this to see what the compiler says:
Dog d1("d1");
Dog d3("d3");
d3 = d1; // this calls the assignment operator, which
// is declared private and not implemented
avatar
t*t
11
Dog d3(d1) is called direct-initialization
Dog d3=d1 is called copy-initialization
well, now you know the name, try google it...
but again, the difference is subtle. most of times you can ignore it.

【在 n**d 的大作中提到】
:
: you
: Do you mean to think they are the same for now
: Give me a hint how to search your previous post.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。