C
coal
I've been thinking about implementing some of the ideas
discussed in this thread on clc++m.
http://preview.tinyurl.com/2l8cnh
Mainly how to go about calculating the total message
length and using it in a header before sending the payload.
In some cases like vector<int>, it is easy to multiply the size
of the vector by the size of an int and determine how many bytes are
involved. If it is a vector<string> though, I have to add up the
lengths of all of the strings.
I've wondered whether it would be helpful to have containers
that tracked the total number of bytes they are managing
rather than going through this calculation each time.
For example, if a set<string> has thousands of elements
and only a handful of changes occur to the set between
uses of the set as a marshalling parameter, the work to
count up everything from scratch seems like a waste
compared to just making a few additions/subtractions to
a count.
Any thoughts on the utility and design of containers
like that?
Brian Wood
Ebenezer Enterprises
www.webebenezer.net
discussed in this thread on clc++m.
http://preview.tinyurl.com/2l8cnh
Mainly how to go about calculating the total message
length and using it in a header before sending the payload.
In some cases like vector<int>, it is easy to multiply the size
of the vector by the size of an int and determine how many bytes are
involved. If it is a vector<string> though, I have to add up the
lengths of all of the strings.
I've wondered whether it would be helpful to have containers
that tracked the total number of bytes they are managing
rather than going through this calculation each time.
For example, if a set<string> has thousands of elements
and only a handful of changes occur to the set between
uses of the set as a marshalling parameter, the work to
count up everything from scratch seems like a waste
compared to just making a few additions/subtractions to
a count.
Any thoughts on the utility and design of containers
like that?
Brian Wood
Ebenezer Enterprises
www.webebenezer.net