欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

structured_pair.hpp

Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
HPP
第 1 页 / 共 2 页
字号:
/**This class allows you to specify the order in wich the two data types will bein the layout of the class.                                                                               **/template< class FirstType, class SecondType, class Info, class Layout = normal_layout >class structured_pair :    public ::boost::bimaps::relation::detail::pair_info_hook    <        FirstType, SecondType,        Info,        Layout    >{    typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::detail::pair_info_hook    <        FirstType, SecondType,        Info,        Layout    > base_;    public:    typedef ::boost::mpl::vector3<        structured_pair< FirstType, SecondType, Info, normal_layout >,        structured_pair< FirstType, SecondType, Info, mirror_layout >,        BOOST_DEDUCED_TYPENAME ::boost::mpl::if_<            BOOST_DEDUCED_TYPENAME ::boost::is_same<Layout, normal_layout>::type,            mutant_relation< FirstType, SecondType, Info, true >,            mutant_relation< SecondType, FirstType, Info, true >        >::type    > mutant_views;    structured_pair() {}    structured_pair(BOOST_DEDUCED_TYPENAME boost::call_traits<                        BOOST_DEDUCED_TYPENAME base_::first_type  >::param_type f,                    BOOST_DEDUCED_TYPENAME boost::call_traits<                        BOOST_DEDUCED_TYPENAME base_::second_type >::param_type s)        : base_(f,s) {}    structured_pair(BOOST_DEDUCED_TYPENAME boost::call_traits<                        BOOST_DEDUCED_TYPENAME base_::first_type  >::param_type f,                    BOOST_DEDUCED_TYPENAME boost::call_traits<                        BOOST_DEDUCED_TYPENAME base_::second_type >::param_type s,                    BOOST_DEDUCED_TYPENAME boost::call_traits<                        BOOST_DEDUCED_TYPENAME base_::info_type   >::param_type i)        : base_(f,s,i) {}    template< class OtherLayout >    structured_pair(        const structured_pair<FirstType,SecondType,Info,OtherLayout> & p)        : base_(p) {}    template< class OtherLayout >    structured_pair& operator=(        const structured_pair<FirstType,SecondType,OtherLayout> & p)    {        base_::change_to(p);        return *this;    }    template< class First, class Second >    structured_pair(const std::pair<First,Second> & p) :        base_(p.first,p.second)    {}    template< class First, class Second >    structured_pair& operator=(const std::pair<First,Second> & p)    {        base_::first  = p.first;        base_::second = p.second;        base_::clear_info();        return *this;    }    template< class Tag >    const BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::        result_of::get<Tag,const structured_pair>::type    get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag)) const    {        return ::boost::bimaps::relation::support::get<Tag>(*this);    }    template< class Tag >    BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::        result_of::get<Tag,structured_pair>::type    get(BOOST_EXPLICIT_TEMPLATE_TYPE(Tag))    {        return ::boost::bimaps::relation::support::get<Tag>(*this);    }};// structured_pair - structured_pairtemplate< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >bool operator==(const structured_pair<FirstType,SecondType,Info,Layout1> & a,                const structured_pair<FirstType,SecondType,Info,Layout2> & b){    return ( ( a.first  == b.first  ) &&             ( a.second == b.second ) );}template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >bool operator!=(const structured_pair<FirstType,SecondType,Info,Layout1> & a,                const structured_pair<FirstType,SecondType,Info,Layout2> & b){    return ! ( a == b );}template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >bool operator<(const structured_pair<FirstType,SecondType,Info,Layout1> & a,               const structured_pair<FirstType,SecondType,Info,Layout2> & b){    return (  ( a.first  <  b.first  ) ||             (( a.first == b.first ) && ( a.second < b.second )));}template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >bool operator<=(const structured_pair<FirstType,SecondType,Info,Layout1> & a,                const structured_pair<FirstType,SecondType,Info,Layout2> & b){    return (  ( a.first  <  b.first  ) ||             (( a.first == b.first ) && ( a.second <= b.second )));}template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >bool operator>(const structured_pair<FirstType,SecondType,Info,Layout1> & a,               const structured_pair<FirstType,SecondType,Info,Layout2> & b){    return ( ( a.first  >  b.first  ) ||             (( a.first == b.first ) && ( a.second > b.second )));}template< class FirstType, class SecondType, class Info, class Layout1, class Layout2 >bool operator>=(const structured_pair<FirstType,SecondType,Info,Layout1> & a,                const structured_pair<FirstType,SecondType,Info,Layout2> & b){    return ( ( a.first  >  b.first  ) ||             (( a.first == b.first ) && ( a.second >= b.second )));}// structured_pair - std::pairtemplate< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator==(const structured_pair<FirstType,SecondType,Info,Layout> & a,                const std::pair<F,S> & b){    return ( ( a.first  == b.first  ) &&             ( a.second == b.second ) );}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator!=(const structured_pair<FirstType,SecondType,Info,Layout> & a,                const std::pair<F,S> & b){    return ! ( a == b );}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator<(const structured_pair<FirstType,SecondType,Info,Layout> & a,               const std::pair<F,S> & b){    return (  ( a.first  <  b.first  ) ||             (( a.first == b.first ) && ( a.second < b.second )));}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator<=(const structured_pair<FirstType,SecondType,Info,Layout> & a,                const std::pair<F,S> & b){    return (  ( a.first  <  b.first  ) ||             (( a.first == b.first ) && ( a.second <= b.second )));}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator>(const structured_pair<FirstType,SecondType,Info,Layout> & a,               const std::pair<F,S> & b){    return ( ( a.first  >  b.first  ) ||             (( a.first == b.first ) && ( a.second > b.second )));}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator>=(const structured_pair<FirstType,SecondType,Info,Layout> & a,                const std::pair<F,S> & b){    return ( ( a.first  >  b.first  ) ||             (( a.first == b.first ) && ( a.second >= b.second )));}// std::pair - sturctured_pairtemplate< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator==(const std::pair<F,S> & a,                const structured_pair<FirstType,SecondType,Info,Layout> & b){    return ( ( a.first  == b.first  ) &&             ( a.second == b.second ) );}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator!=(const std::pair<F,S> & a,                const structured_pair<FirstType,SecondType,Info,Layout> & b){    return ! ( a == b );}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator<(const std::pair<F,S> & a,               const structured_pair<FirstType,SecondType,Info,Layout> & b){    return (  ( a.first  <  b.first  ) ||             (( a.first == b.first ) && ( a.second < b.second )));}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator<=(const std::pair<F,S> & a,                const structured_pair<FirstType,SecondType,Info,Layout> & b){    return (  ( a.first  <  b.first  ) ||             (( a.first == b.first ) && ( a.second <= b.second )));}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator>(const std::pair<F,S> & a,               const structured_pair<FirstType,SecondType,Info,Layout> & b){    return ( ( a.first  >  b.first  ) ||             (( a.first == b.first ) && ( a.second > b.second )));}template< class FirstType, class SecondType, class Info, class Layout, class F, class S >bool operator>=(const std::pair<F,S> & a,                const structured_pair<FirstType,SecondType,Info,Layout> & b){    return ( ( a.first  >  b.first  ) ||             (( a.first == b.first ) && ( a.second >= b.second )));}} // namespace relation} // namespace bimaps} // namespace boost#endif // BOOST_BIMAP_RELATION_STRUCTURED_PAIR_HPP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -