Opened 9 years ago

Closed 7 years ago

#2356 closed Bugs (fixed)

bug at compile time when using customized char_traits

Reported by: Nicolas Vanhoren <nicolas.vanhoren@…> Owned by: turkanis
Milestone: Component: iostreams
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:


This is quite simple, boost::iostream::stream and boost::iostream::stream_buffer are obviously made to allow the usage of customized char_traits (I mean, a character trait class that is not some sort a specialization of std::char_trait), as we can guess it by looking at their optional second template argument.

But when doing so, it does not compile (see test.cpp). This problem seems to come from an internal class of iostreams, concept_adapter, and one of its methods. As I can understand, that method forces a buffer to a type like std::basic_buffer<Any,std::char_traits<Any> >, which is incorrect (it should uses the character trait type passed as an argument to boost::iostreams::stream).

The provided patch is working, but it just some trick to allow the code to compile. In the worst case that little helper class should be redesigned to add the character trait type to the list of its template parameters.

Attachments (2)

test.cpp (339 bytes) - added by Nicolas Vanhoren <nicolas.vanhoren@…> 9 years ago.
code to reproduce the bug
correction.diff (586 bytes) - added by Nicolas Vanhoren <nicolas.vanhoren@…> 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Nicolas Vanhoren <nicolas.vanhoren@…>

code to reproduce the bug

Changed 9 years ago by Nicolas Vanhoren <nicolas.vanhoren@…>


comment:1 Changed 9 years ago by turkanis

  • Status changed from new to assigned

comment:2 Changed 7 years ago by steven_watanabe

A better fix would be to eliminate basic_streambuf entirely, and make the argument a template parameter. This is consistent with the behavior of other filters.

comment:3 Changed 7 years ago by steven_watanabe

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [63034]) Make concept_adapter work with custom char_traits. Fixes #2356.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain turkanis.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.