|
Boost-Commit : |
From: technews_at_[hidden]
Date: 2008-05-31 18:49:41
Author: turkanis
Date: 2008-05-31 18:49:41 EDT (Sat, 31 May 2008)
New Revision: 45996
URL: http://svn.boost.org/trac/boost/changeset/45996
Log:
added static asserts
Text files modified:
trunk/boost/iostreams/combine.hpp | 19 +++++++++++++++----
trunk/boost/iostreams/compose.hpp | 4 ++++
trunk/boost/iostreams/invert.hpp | 1 +
trunk/boost/iostreams/tee.hpp | 3 +++
4 files changed, 23 insertions(+), 4 deletions(-)
Modified: trunk/boost/iostreams/combine.hpp
==============================================================================
--- trunk/boost/iostreams/combine.hpp (original)
+++ trunk/boost/iostreams/combine.hpp 2008-05-31 18:49:41 EDT (Sat, 31 May 2008)
@@ -45,6 +45,10 @@
//
template<typename Source, typename Sink>
class combined_device {
+private:
+ typedef typename category_of<Source>::type in_category;
+ typedef typename category_of<Sink>::type out_category;
+ typedef typename char_type_of<Sink>::type sink_char_type;
public:
typedef typename char_type_of<Source>::type char_type;
struct category
@@ -53,6 +57,11 @@
closable_tag,
localizable_tag
{ };
+ BOOST_STATIC_ASSERT(is_device<Source>::value);
+ BOOST_STATIC_ASSERT(is_device<Sink>::value);
+ BOOST_STATIC_ASSERT((is_convertible<in_category, input>::value));
+ BOOST_STATIC_ASSERT((is_convertible<out_category, output>::value));
+ BOOST_STATIC_ASSERT((is_same<char_type, sink_char_type>::value));
combined_device(const Source& src, const Sink& snk);
std::streamsize read(char_type* s, std::streamsize n);
std::streamsize write(const char_type* s, std::streamsize n);
@@ -61,8 +70,6 @@
void imbue(const std::locale& loc);
#endif
private:
- typedef typename char_type_of<Sink>::type sink_char_type;
- BOOST_STATIC_ASSERT((is_same<char_type, sink_char_type>::value));
Source src_;
Sink sink_;
};
@@ -81,6 +88,7 @@
private:
typedef typename category_of<InputFilter>::type in_category;
typedef typename category_of<OutputFilter>::type out_category;
+ typedef typename char_type_of<OutputFilter>::type output_char_type;
public:
typedef typename char_type_of<InputFilter>::type char_type;
struct category
@@ -88,6 +96,11 @@
closable_tag,
localizable_tag
{ };
+ BOOST_STATIC_ASSERT(is_filter<InputFilter>::value);
+ BOOST_STATIC_ASSERT(is_filter<OutputFilter>::value);
+ BOOST_STATIC_ASSERT((is_convertible<in_category, input>::value));
+ BOOST_STATIC_ASSERT((is_convertible<out_category, output>::value));
+ BOOST_STATIC_ASSERT((is_same<char_type, output_char_type>::value));
combined_filter(const InputFilter& in, const OutputFilter& out);
template<typename Source>
@@ -120,8 +133,6 @@
void imbue(const std::locale& loc);
#endif
private:
- typedef typename char_type_of<OutputFilter>::type output_char_type;
- BOOST_STATIC_ASSERT((is_same<char_type, output_char_type>::value));
InputFilter in_;
OutputFilter out_;
};
Modified: trunk/boost/iostreams/compose.hpp
==============================================================================
--- trunk/boost/iostreams/compose.hpp (original)
+++ trunk/boost/iostreams/compose.hpp 2008-05-31 18:49:41 EDT (Sat, 31 May 2008)
@@ -74,6 +74,8 @@
is_std_io<Device>, Device&,
else_, Device
>::type value_type;
+ BOOST_STATIC_ASSERT(is_filter<Filter>::value);
+ BOOST_STATIC_ASSERT(is_device<Device>::value);
public:
typedef typename char_type_of<Filter>::type char_type;
struct category
@@ -140,6 +142,8 @@
!(is_convertible<first_mode, output>::value) ||
(is_convertible<first_mode, dual_use>::value)
);
+ BOOST_STATIC_ASSERT(is_filter<Filter1>::value);
+ BOOST_STATIC_ASSERT(is_filter<Filter2>::value);
public:
typedef typename char_type_of<Filter1>::type char_type;
struct category
Modified: trunk/boost/iostreams/invert.hpp
==============================================================================
--- trunk/boost/iostreams/invert.hpp (original)
+++ trunk/boost/iostreams/invert.hpp 2008-05-31 18:49:41 EDT (Sat, 31 May 2008)
@@ -44,6 +44,7 @@
template<typename Filter>
class inverse {
private:
+ BOOST_STATIC_ASSERT(is_filter<Filter>::value);
typedef typename category_of<Filter>::type base_category;
typedef reference_wrapper<Filter> filter_ref;
public:
Modified: trunk/boost/iostreams/tee.hpp
==============================================================================
--- trunk/boost/iostreams/tee.hpp (original)
+++ trunk/boost/iostreams/tee.hpp 2008-05-31 18:49:41 EDT (Sat, 31 May 2008)
@@ -48,6 +48,7 @@
optimally_buffered_tag
{ };
+ BOOST_STATIC_ASSERT(is_device<Device>::value);
BOOST_STATIC_ASSERT((
is_convertible< // Using mode_of causes failures on VC6-7.0.
BOOST_DEDUCED_TYPENAME iostreams::category_of<Device>::type, output
@@ -120,6 +121,8 @@
output,
input
>::type mode;
+ BOOST_STATIC_ASSERT(is_device<Device>::value);
+ BOOST_STATIC_ASSERT(is_device<Sink>::value);
BOOST_STATIC_ASSERT((
is_same<
char_type,
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk