diff --git a/boost/operator_idp5204304.html b/boost/operator_idp5204304.html new file mode 100644 index 0000000..7baaf6b --- /dev/null +++ b/boost/operator_idp5204304.html @@ -0,0 +1,55 @@ + + + +Function operator<< + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+
+
+

Function operator<<

+

boost::operator<<

+
+

Synopsis

+
// In header: <boost/type_index.hpp>
+
+
+std::basic_ostream & 
+operator<<(std::basic_ostream, template_index/type_index const & rhs);
+
+

Description

+

Output operators for type_index and template_index

+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/template_id.html b/boost/template_id.html index f0998be..1ff106f 100644 --- a/boost/template_id.html +++ b/boost/template_id.html @@ -34,7 +34,7 @@ template<typename T> template_index template_id();
-

Description

+

Description

Method for constructing template_index instance for type T. Strips const, volatile and & modifiers from T.

diff --git a/boost/template_id_with_cvr.html b/boost/template_id_with_cvr.html index d6e51ac..93823e4 100644 --- a/boost/template_id_with_cvr.html +++ b/boost/template_id_with_cvr.html @@ -34,7 +34,7 @@ template<typename T> template_index template_id_with_cvr();
-

Description

+

Description

Factory method for constructing template_index instance for type T. Does not strips const, volatile and & modifiers from T.

diff --git a/boost/template_index.html b/boost/template_index.html index e9e5d5f..e5f5206 100644 --- a/boost/template_index.html +++ b/boost/template_index.html @@ -35,59 +35,59 @@ class template_index { public: // construct/copy/destruct - template_index(); + template_index(); - // public member functions - bool before(const template_index &) const; - const char * name() const; - std::string name_demangled() const; - std::size_t hash_code() const; + // public member functions + bool before(const template_index &) const; + const char * name() const; + std::string name_demangled() const; + std::size_t hash_code() const; - // public static functions - template<typename T> static template_index construct(); - template<typename T> static template_index construct_with_cvr(); + // public static functions + template<typename T> static template_index construct(); + template<typename T> static template_index construct_with_cvr(); };
-

Description

+

Description

Copyable type_info that does not require RTTI and could store const, volatile and references if constructed via construct_with_cvr()

-

+

template_index public construct/copy/destruct

  1. -
    template_index();
    +
    template_index();

    Default constructor.

-

-template_index public member functions

+

+template_index public member functions

  1. -
    bool before(const template_index & rhs) const;
    +
    bool before(const template_index & rhs) const;

    Returns true if the type precedes the type of rhs in the collation order. The collation order is just an internal order.

  2. -
    const char * name() const;
    Returns raw name.
  3. +
    const char * name() const;
    Returns raw name.
  4. -
    std::string name_demangled() const;
    Returns user-friendly name.
  5. +
    std::string name_demangled() const;
    Returns user-friendly name.
  6. -
    std::size_t hash_code() const;
    +
    std::size_t hash_code() const;

    Function for getting hash value

-

-template_index public static functions

+

+template_index public static functions

  1. -
    template<typename T> static template_index construct();
    +
    template<typename T> static template_index construct();

    Factory method for constructing template_index instance for type T. Strips const, volatile and & modifiers from T

  2. -
    template<typename T> static template_index construct_with_cvr();
    +
    template<typename T> static template_index construct_with_cvr();

    Factory method for constructing template_index instance for type T. Does not strips const, volatile and & modifiers from T

diff --git a/boost/type_id.html b/boost/type_id.html index 535ba9d..ef838b2 100644 --- a/boost/type_id.html +++ b/boost/type_id.html @@ -7,7 +7,7 @@ - + @@ -20,7 +20,7 @@

-PrevUpHomeNext +PrevUpHomeNext
@@ -34,7 +34,7 @@ template<typename T> type_index type_id();
-

Description

+

Description

Function, to get type_index for a type T. Strips const, volatile and & modifiers from T.

@@ -48,7 +48,7 @@
-PrevUpHomeNext +PrevUpHomeNext
diff --git a/boost/type_id_rtti_on_idp5198032.html b/boost/type_id_rtti_on_idp5198032.html new file mode 100644 index 0000000..40dae87 --- /dev/null +++ b/boost/type_id_rtti_on_idp5198032.html @@ -0,0 +1,54 @@ + + + +Function template type_id_rtti_only + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+
+
+

Function template type_id_rtti_only

+

boost::type_id_rtti_only

+
+

Synopsis

+
// In header: <boost/type_index.hpp>
+
+
+template<typename T> type_index type_id_rtti_only(T & rtti_val);
+
+

Description

+

Function, that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. This method available only with RTTI enabled.

+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/type_id_rtti_on_idp5201168.html b/boost/type_id_rtti_on_idp5201168.html new file mode 100644 index 0000000..a0cd9a1 --- /dev/null +++ b/boost/type_id_rtti_on_idp5201168.html @@ -0,0 +1,54 @@ + + + +Function template type_id_rtti_only + + + + + + + + + + + + + + + +
Boost C++ LibrariesHomeLibrariesPeopleFAQMore
+
+
+PrevUpHomeNext +
+
+
+
+

Function template type_id_rtti_only

+

boost::type_id_rtti_only

+
+

Synopsis

+
// In header: <boost/type_index.hpp>
+
+
+template<typename T> type_index type_id_rtti_only(T * rtti_val);
+
+

Description

+

Function, that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. This method available only with RTTI enabled.

+
+
+ + + +
+
+
+PrevUpHomeNext +
+ + diff --git a/boost/type_index.html b/boost/type_index.html index bc465fb..b2b14d8 100644 --- a/boost/type_index.html +++ b/boost/type_index.html @@ -38,61 +38,61 @@ typedef std::type_info stl_type_info; // construct/copy/destruct - type_index(); + type_index(); - // public member functions - bool before(type_index const &) const; - const char * name() const; - std::string name_demangled() const; - std::size_t hash_code() const; + // public member functions + bool before(type_index const &) const; + const char * name() const; + std::string name_demangled() const; + std::size_t hash_code() const; - // public static functions - template<typename T> static type_index construct(); - template<typename T> static type_index construct_rtti_only(T &); - template<typename T> static type_index construct_rtti_only(T *); + // public static functions + template<typename T> static type_index construct(); + template<typename T> static type_index construct_rtti_only(T &); + template<typename T> static type_index construct_rtti_only(T *); };
-

Description

+

Description

-

+

type_index public construct/copy/destruct

  1. -
    type_index();
    +
    type_index();

    Default constructor.

-

-type_index public member functions

+

+type_index public member functions

  1. -
    bool before(type_index const & rhs) const;
    +
    bool before(type_index const & rhs) const;

    Returns true if the type precedes the type of rhs in the collation order. The collation order is just an internal order.

  2. -
    const char * name() const;
    Returns raw name.
  3. +
    const char * name() const;
    Returns raw name.
  4. -
    std::string name_demangled() const;
    Returns user-friendly name.
  5. +
    std::string name_demangled() const;
    Returns user-friendly name.
  6. -
    std::size_t hash_code() const;
    Function for getting hash value.
  7. +
    std::size_t hash_code() const;
    Function for getting hash value.
-

-type_index public static functions

+

+type_index public static functions

  1. -
    template<typename T> static type_index construct();
    +
    template<typename T> static type_index construct();

    Factory method for constructing type_index instance for type T. Strips const, volatile and & modifiers from T.

  2. -
    template<typename T> static type_index construct_rtti_only(T & rtti_val);
    +
    template<typename T> static type_index construct_rtti_only(T & rtti_val);

    Factory function, that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. This method available only with RTTI enabled.

  3. -
    template<typename T> static type_index construct_rtti_only(T * rtti_val);
    +
    template<typename T> static type_index construct_rtti_only(T * rtti_val);

    Factory function, that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. This method available only with RTTI enabled.

diff --git a/boost_typeindex/examples.html b/boost_typeindex/examples.html index dea3a45..809559f 100644 --- a/boost_typeindex/examples.html +++ b/boost_typeindex/examples.html @@ -27,10 +27,10 @@ Examples

- All the code in examples will work with and without RTTI support. + All code in the examples will work with and without RTTI support.

- Class that allows to register type only once. + Class that allows to register a given type only once.

class types_registry {
     unordered_set<type_index> types_;
@@ -41,7 +41,7 @@
         type_index ti = type_id<T>();
         std::cout << "Adding type " << ti << " to registry \n";
         if (!types_.insert(ti).second)
-            throw std::logic_error("Type " + ti.name_demangled() + " already in registry");
+            throw std::logic_error("Type " + ti.name_demangled() + " already registered");
     }
 
     template <class T>
@@ -58,6 +58,13 @@
     std::cout << "Has type int: " << tr.has_type<int>()
         << "\nHas type std::string: " << tr.has_type<std::string>()
         << '\n';
+
+    try {
+        tr.add_type<const int>(); // Will throw
+    } catch (const std::logic_error& e) {
+        // Will print "Type int already registered"
+        std::cout << e.what() << std::endl;
+    }
 }
 

@@ -73,9 +80,9 @@

- Another example (this time checking for exact parameter match). my_unary_function is a class, that stroes - function with result type ResultT - and any input parameter type. In opertaor(), it checks for input parameter match and + Another example, this time checking for exact parameter match. my_unary_function is a class, that stores + a function with result type ResultT + and any input parameter type. In operator(), it checks for input parameter match and then executes the stored function:

diff --git a/boost_typeindex/getting_started.html b/boost_typeindex/getting_started.html index b2b7820..92ba6ae 100644 --- a/boost_typeindex/getting_started.html +++ b/boost_typeindex/getting_started.html @@ -27,17 +27,18 @@ Getting started

- In short: Just replace &typeid(T), - typeid(T) with - boost::type_id<T>() and - const std::type_info&, std::type_index - with boost::type_index. For cases when RTTI is really + In short: Just replace typeid(T), + &typeid(T) + with boost::type_id<T>() and + std::type_index, const + std::type_info& + with boost::type_index. For cases when RTTI is actually required, replace typeid(variable) with boost::type_id_rtti_only(variable). That's all, you are now using Boost.TypeIndex.

- To get nice human readable name, use name_demangled() member function: + To get nice human readable names, use the name_demangled() member function:

type_index ti = type_id<T>();
 std::string nice_name = ti.name_demangled();
@@ -47,14 +48,16 @@
 

- template_index and type_index have full set of comparison operators, - hashing functions and ostream operators. Thay can be used with any container - class. + template_index and type_index provide the full set of comparison + operators, hashing functions and ostream operators. Thay can be used with any + container class.

- If you need to save const, volatile and references, use boost::template_index - instead of boost::type_index; boost::template_id_with_cvr<T>() - instead of boost::type_id<T>(). + If you need to preserve const, + volatile and references, use + boost::template_index instead of boost::type_index; + boost::template_id_with_cvr<T>() instead + of boost::type_id<T>().

diff --git a/boost_typeindex/performance.html b/boost_typeindex/performance.html index 65db40e..6b19a22 100644 --- a/boost_typeindex/performance.html +++ b/boost_typeindex/performance.html @@ -6,7 +6,7 @@ - +
@@ -19,7 +19,7 @@

-PrevUpHome +PrevUpHome

@@ -30,22 +30,21 @@ so they are easy and fast to copy. Calls to const char* name() do not require dynamic memory allocation and usually just return a pointer to - an array of chars in read-only section of binary file. Comparison operators - are optimized as much as possible, and in worst case only execute std::strcmp. + an array of chars in a read-only section of the binary image. Comparison operators + are optimized as much as possible, and will at worst execute a single std::strcmp. Calls to std::string name_demangled() for type_index do usually require dynamic memory allocation and some computations, so they are not recomended for usage in performance critical sections. Calls to std::string name_demangled() - for template_index require - only std::strlen call and are much faster than std::string - name_demangled() - for type_index. + for template_index only require + a single std::strlen call and are considerably faster than + std::string name_demangled() for type_index.

- template_index uses BOOST_CURRENT_FUNCTION macro, which could - lead to code bloat. So if you do not need to save const, - volatile and references, use - type_index. + template_index uses the BOOST_CURRENT_FUNCTION macro, which could + lead to code bloat. In those cases where preserving const, + volatile and references is not + needed prefer using type_index.

@@ -58,7 +57,7 @@

-PrevUpHome +PrevUpHome
diff --git a/boost_typeindex_header_reference.html b/boost_typeindex_header_reference.html index ed38ab8..6eb31e2 100644 --- a/boost_typeindex_header_reference.html +++ b/boost_typeindex_header_reference.html @@ -35,20 +35,20 @@ template<typename T> template_index template_id(); template<typename T> template_index template_id_with_cvr(); template<typename T> type_index type_id(); - template<typename T> type_index type_id_rtti_only(T &); - template<typename T> type_index type_id_rtti_only(T *); + template<typename T> type_index type_id_rtti_only(T &); + template<typename T> type_index type_id_rtti_only(T *); std::basic_ostream & - operator<<(std::basic_ostream, template_index/type_index const &); + operator<<(std::basic_ostream, template_index/type_index const &); // All possible operators for comparison of std::type_info's and type_index'es. - bool operator(type_index/std::type_info const & lhs, + bool operator(type_index/std::type_info const & lhs, type_index/std::type_info const & rhs); // All possible operators for comparison of template_index'es. - bool operator(template_index const & lhs, template_index const & rhs); + bool operator(template_index const & lhs, template_index const & rhs); // All possible operators for comparison of type_index'es. - bool operator(type_index const & lhs, type_index const & rhs); + bool operator(type_index const & lhs, type_index const & rhs); }
diff --git a/index.html b/index.html index 59ec41b..afc9f2a 100644 --- a/index.html +++ b/index.html @@ -46,9 +46,9 @@ Motivation

- Sometimes getting and storing at runtime information about template type is - required. For such cases usually used a construction like &typeid(T) or C++11 class std::type_index. - And that is the point, where problems strat: + Sometimes getting and storing information about a template type at runtime + is required. For such cases a construction like &typeid(T) or C++11 class std::type_index + is usually used. And that is the point, where problems strat:

@@ -91,8 +86,8 @@ Note

- T means here type. Think - of it, as of T in template <class T> + T means type here. Think + of it as of T in template <class T>

@@ -107,7 +102,7 @@
- +

Last revised: July 04, 2012 at 19:12:10 GMT

Last revised: July 09, 2012 at 18:13:07 GMT


diff --git a/standalone_HTML.manifest b/standalone_HTML.manifest index af60ce4..3631150 100644 --- a/standalone_HTML.manifest +++ b/standalone_HTML.manifest @@ -7,7 +7,7 @@ boost/type_index.html boost/template_id.html boost/template_id_with_cvr.html boost/type_id.html -boost/type_id_rtti_on_idp5183808.html -boost/type_id_rtti_on_idp5186944.html -boost/operator_idp5190080.html +boost/type_id_rtti_on_idp5198032.html +boost/type_id_rtti_on_idp5201168.html +boost/operator_idp5204304.html boost_typeindex/performance.html