c++.stlsoft - Fastformat::fmt_slices
- Claudio Albuquerque (13/13) May 29 2012 Hi Mathew,
- Matt Wilson (14/33) Jun 04 2012 Hi Cláudio
- =?ISO-8859-1?Q?Cl=e1udio?= (5/55) Jul 10 2012 Hi Matt,
- Matt Wilson (4/64) Jul 16 2012 Cool. Let me know how it goes.
Hi Mathew, I've been on the process of including the fastformat to the project framework and replacing "manual" formating an other string formating code by it. But I've encountered an issue. I've a class that maps it self onto a string array, providing some standard functionality that makes sense to a wchar_t[] or char[]. Now my size() method is returning the full capacity of the array. So in method fmt_slices, the following code: ... sink.reserve(sink.size() + cchTotal + 2); // Ask for two more, in case need CR (&LF) ... will cause the reserve method to be called with a capacity that exceeds the current array string and it will cause an exception, since there is no possibility for reallocation. So, do you any recommendation to get around this issue? Thanks Cláudio Albuquerque
May 29 2012
Hi Cláudio From your description, I assume that you've not overridden the fmt_slices action shim for your own type. That's what you need to do, otherwise, by default, it goes to the one that assumes conformance with the std::(w)string. Have a look at any of the overloads of the shim for different sink types in the include/fastformat/sinks directory: all you have to do is follow suit for your own type. I'll be happy to help - offline if you wish (as I assume it's proprietary code) - after you've had a stab at it. Let me know Matt "Claudio Albuquerque" <claudio.albuquerque gmail.com> wrote in message news:jq40ss$pu1$1 digitalmars.com...Hi Mathew, I've been on the process of including the fastformat to the project framework and replacing "manual" formating an other string formating code by it. But I've encountered an issue. I've a class that maps it self onto a string array, providing some standard functionality that makes sense to a wchar_t[] or char[]. Now my size() method is returning the full capacity of the array. So in method fmt_slices, the following code: ... sink.reserve(sink.size() + cchTotal + 2); // Ask for two more, in case need CR (&LF) ... will cause the reserve method to be called with a capacity that exceeds the current array string and it will cause an exception, since there is no possibility for reallocation. So, do you any recommendation to get around this issue? Thanks Cláudio Albuquerque
Jun 04 2012
Hi Matt, Yes you're correct I haven't overridden the fmt_slices action shim. I expect to have time this month to re-iterate over this issue again, I follow your advice and lets see how it goes. Thanks for the feedback Cláudio AlbuquerqueHi Cláudio From your description, I assume that you've not overridden the fmt_slices action shim for your own type. That's what you need to do, otherwise, by default, it goes to the one that assumes conformance with the std::(w)string. Have a look at any of the overloads of the shim for different sink types in the include/fastformat/sinks directory: all you have to do is follow suit for your own type. I'll be happy to help - offline if you wish (as I assume it's proprietary code) - after you've had a stab at it. Let me know Matt "Claudio Albuquerque" <claudio.albuquerque gmail.com> wrote in message news:jq40ss$pu1$1 digitalmars.com...Hi Mathew, I've been on the process of including the fastformat to the project framework and replacing "manual" formating an other string formating code by it. But I've encountered an issue. I've a class that maps it self onto a string array, providing some standard functionality that makes sense to a wchar_t[] or char[]. Now my size() method is returning the full capacity of the array. So in method fmt_slices, the following code: ... sink.reserve(sink.size() + cchTotal + 2); // Ask for two more, in case need CR (&LF) ... will cause the reserve method to be called with a capacity that exceeds the current array string and it will cause an exception, since there is no possibility for reallocation. So, do you any recommendation to get around this issue? Thanks Cláudio Albuquerque
Jul 10 2012
Cool. Let me know how it goes. Matt "Cláudio" <claudio.albuquerque gmail.com> wrote in message news:jtil06$1m9m$1 digitalmars.com...Hi Matt, Yes you're correct I haven't overridden the fmt_slices action shim. I expect to have time this month to re-iterate over this issue again, I follow your advice and lets see how it goes. Thanks for the feedback Cláudio AlbuquerqueHi Cláudio From your description, I assume that you've not overridden the fmt_slices action shim for your own type. That's what you need to do, otherwise, by default, it goes to the one that assumes conformance with the std::(w)string. Have a look at any of the overloads of the shim for different sink types in the include/fastformat/sinks directory: all you have to do is follow suit for your own type. I'll be happy to help - offline if you wish (as I assume it's proprietary code) - after you've had a stab at it. Let me know Matt "Claudio Albuquerque" <claudio.albuquerque gmail.com> wrote in message news:jq40ss$pu1$1 digitalmars.com...Hi Mathew, I've been on the process of including the fastformat to the project framework and replacing "manual" formating an other string formating code by it. But I've encountered an issue. I've a class that maps it self onto a string array, providing some standard functionality that makes sense to a wchar_t[] or char[]. Now my size() method is returning the full capacity of the array. So in method fmt_slices, the following code: ... sink.reserve(sink.size() + cchTotal + 2); // Ask for two more, in case need CR (&LF) ... will cause the reserve method to be called with a capacity that exceeds the current array string and it will cause an exception, since there is no possibility for reallocation. So, do you any recommendation to get around this issue? Thanks Cláudio Albuquerque
Jul 16 2012