t&section=1 "Edit
section: Example") ]  Example

Run this code

    
    
    #include <ranges>
     
    struct A {
        char* begin();
        char* end();
    };
    static_assert( std::ranges::common_range<A> );
     
    struct B {
        char* begin();
        bool end();
    };  // not a common_range: begin/end have different types
    static_assert( not std::ranges::common_range<B> );
     
    struct C {
        char* begin();
    };  // not a common_range, not even a range: has no end()
    static_assert( not std::ranges::common_range<C> );
     
    int main() { }

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/common_range&action=edit&section=2 "Edit
section: See also") ]  See also

[ ranges::common_view  views::common  ](/w/cpp/ranges/common_view "cpp/ranges/common view") (C++20)  |  converts a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") into a **` common_range ` **   
(class template)  (range adaptor object)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/dsc_common_view&action=edit)  
---|---  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/common_range&oldid=146111
](https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/common_range&oldid=146111)
"

#####  Navigation

  * [ Support us ](http://www.cppreference.com/support)
  * [ Recent changes ](/w/Special:RecentChanges "A list of recent changes in the wiki \[r\]")
  * [ FAQ ](/w/Cppreference:FAQ)
  * [ Offline version ](/w/Cppreference:Archives)

#####  Toolbox

  * [ What links here ](/w/Special:WhatLinksHere/cpp/ranges/common_range "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/ranges/common_range "Recent changes in pages linked from this page \[k\]")
  * [ Upload file ](http://upload.cppreference.com/w/Special:Upload "Upload files \[u\]")
  * [ Special pages ](/w/Special:SpecialPages "A list of all special pages \[q\]")
  * [ Printable version ](/mwiki/index.php?title=cpp/ranges/common_range&printable=yes "Printable version of this page \[p\]")
  * [ Permanent link ](/mwiki/index.php?title=cpp/ranges/common_range&oldid=146111 "Permanent link to this revision of the page")
  * [ Page information ](/mwiki/index.php?title=cpp/ranges/common_range&action=info)

  * In other languages 

  * [ Español ](http://es.cppreference.com/w/cpp/ranges/common_range "cpp/ranges/common range")
  * [ 日本語 ](http://ja.cppreference.com/w/cpp/ranges/common_range "cpp/ranges/common range")
  * [ Русский ](http://ru.cppreference.com/w/cpp/ranges/common_range "cpp/ranges/common range")
  * [ 中文 ](http://zh.cppreference.com/w/cpp/ranges/common_range "cpp/ranges/common range")

  * This page was last modified on 3 January 2023, at 16:39. 
  * This page has been accessed 22,864 times. 

  * [ Privacy policy ](/w/Cppreference:Privacy_policy "Cppreference:Privacy policy")
  * [ About cppreference.com ](/w/Cppreference:About "Cppreference:About")
  * [ Disclaimers ](/w/Cppreference:General_disclaimer "Cppreference:General disclaimer")

  * [ ![Powered by MediaWiki](/mwiki/skins/common/images/poweredby_mediawiki_88x31.png) ](//www.mediawiki.org/) [ ![Powered by GeSHi](//upload.cppreference.com/mwiki/images/2/2b/powered_by_geshi_88x31.png) ](http://qbnz.com/highlighter/) [ ![Hosted by Tiger Technologies](//upload.cppreference.com/mwiki/images/9/94/powered_by_tigertech_88x31.png) ](http://www.tigertech.net/referral/cppreference.com)