123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- // this must occur after all of the includes and before any code appears
- ///////////////////////////////////////////////////////////////////////////////
- namespace boost {
- namespace wave {
- namespace util {
- ///////////////////////////////////////////////////////////////////////////////
- //
- // The symbol_table class is used for the storage of defined macros.
- //
- ///////////////////////////////////////////////////////////////////////////////
- template <typename StringT, typename MacroDefT>
- struct symbol_table
- : public std::map<StringT, boost::shared_ptr<MacroDefT> >
- : public std::map<StringT, boost::intrusive_ptr<MacroDefT> >
- {
- typedef std::map<StringT, boost::shared_ptr<MacroDefT> > base_type;
- typedef std::map<StringT, boost::intrusive_ptr<MacroDefT> > base_type;
- typedef typename base_type::iterator iterator_type;
- typedef typename base_type::const_iterator const_iterator_type;
- symbol_table(long uid_ = 0)
- {}
- private:
- friend class boost::serialization::access;
- template<typename Archive>
- void serialize(Archive &ar, const unsigned int version)
- {
- using namespace boost::serialization;
- ar & make_nvp("symbol_table",
- boost::serialization::base_object<base_type>(*this));
- }
- private:
- ///////////////////////////////////////////////////////////////////////////
- //
- // This is a special iterator allowing to iterate the names of all defined
- // macros.
- //
- ///////////////////////////////////////////////////////////////////////////
- template <typename StringT1>
- struct get_first
- {
- typedef StringT1 const& result_type;
- template <typename First, typename Second>
- StringT1 const& operator() (std::pair<First, Second> const& p) const
- {
- return p.first;
- }
- };
- typedef get_first<StringT> unary_functor;
- public:
- typedef transform_iterator<unary_functor, iterator_type>
- name_iterator;
- typedef transform_iterator<unary_functor, const_iterator_type>
- const_name_iterator;
- template <typename Iterator>
- static
- transform_iterator<unary_functor, Iterator> make_iterator(Iterator it)
- {
- return boost::make_transform_iterator<unary_functor>(it);
- }
- };
- ///////////////////////////////////////////////////////////////////////////////
- } // namespace util
- } // namespace wave
- } // namespace boost
- // the suffix header occurs after all of the code
|