What is an adaptor in the C++ standard? How does it relate to the adapter design pattern?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















The C++ standard uses the word adaptors several times:




  • Allocator adaptors (std::scoped_allocator_adaptor)

  • Container adaptors (std::queue, std::priority_queue, std::stack)

  • Iterator adaptors (std::reverse_iterator, std::move_iterator)


It does not seem that the word itself is defined in the standard. I was thinking that the word was used in reference to design patterns, but it seems that in the adapter design pattern, the adapter should only adapt the interface, not the behavior.



Questions: Therefore I was wondering:




  • What would be the approximate definition of an adaptor in the C++ standard?

  • Does it correspond to the adapter design pattern?

  • If not, what would be the design pattern that matches the best what an adaptor is in the C++ standard (adapter, proxy, facade, decorator...)?










share|improve this question




















  • 2





    I suspect most of those predates the book of 4 book that coined the name.

    – Yakk - Adam Nevraumont
    Nov 16 '18 at 18:38











  • facade might be best. It implements a particular interface on top of an already defined thing.

    – NathanOliver
    Nov 16 '18 at 18:39











  • Fun Fact: we see the same phenomenon in the Java world with old classes like MouseAdapter. A sign of the times?

    – jaco0646
    Nov 16 '18 at 21:02











  • @jaco0646 I just looked into the old history of C++. The word adaptor for iterators was already used in 1994. For containers it's the case in 1995.

    – Vincent
    Nov 16 '18 at 22:04


















0















The C++ standard uses the word adaptors several times:




  • Allocator adaptors (std::scoped_allocator_adaptor)

  • Container adaptors (std::queue, std::priority_queue, std::stack)

  • Iterator adaptors (std::reverse_iterator, std::move_iterator)


It does not seem that the word itself is defined in the standard. I was thinking that the word was used in reference to design patterns, but it seems that in the adapter design pattern, the adapter should only adapt the interface, not the behavior.



Questions: Therefore I was wondering:




  • What would be the approximate definition of an adaptor in the C++ standard?

  • Does it correspond to the adapter design pattern?

  • If not, what would be the design pattern that matches the best what an adaptor is in the C++ standard (adapter, proxy, facade, decorator...)?










share|improve this question




















  • 2





    I suspect most of those predates the book of 4 book that coined the name.

    – Yakk - Adam Nevraumont
    Nov 16 '18 at 18:38











  • facade might be best. It implements a particular interface on top of an already defined thing.

    – NathanOliver
    Nov 16 '18 at 18:39











  • Fun Fact: we see the same phenomenon in the Java world with old classes like MouseAdapter. A sign of the times?

    – jaco0646
    Nov 16 '18 at 21:02











  • @jaco0646 I just looked into the old history of C++. The word adaptor for iterators was already used in 1994. For containers it's the case in 1995.

    – Vincent
    Nov 16 '18 at 22:04














0












0








0








The C++ standard uses the word adaptors several times:




  • Allocator adaptors (std::scoped_allocator_adaptor)

  • Container adaptors (std::queue, std::priority_queue, std::stack)

  • Iterator adaptors (std::reverse_iterator, std::move_iterator)


It does not seem that the word itself is defined in the standard. I was thinking that the word was used in reference to design patterns, but it seems that in the adapter design pattern, the adapter should only adapt the interface, not the behavior.



Questions: Therefore I was wondering:




  • What would be the approximate definition of an adaptor in the C++ standard?

  • Does it correspond to the adapter design pattern?

  • If not, what would be the design pattern that matches the best what an adaptor is in the C++ standard (adapter, proxy, facade, decorator...)?










share|improve this question
















The C++ standard uses the word adaptors several times:




  • Allocator adaptors (std::scoped_allocator_adaptor)

  • Container adaptors (std::queue, std::priority_queue, std::stack)

  • Iterator adaptors (std::reverse_iterator, std::move_iterator)


It does not seem that the word itself is defined in the standard. I was thinking that the word was used in reference to design patterns, but it seems that in the adapter design pattern, the adapter should only adapt the interface, not the behavior.



Questions: Therefore I was wondering:




  • What would be the approximate definition of an adaptor in the C++ standard?

  • Does it correspond to the adapter design pattern?

  • If not, what would be the design pattern that matches the best what an adaptor is in the C++ standard (adapter, proxy, facade, decorator...)?







c++ design-patterns adapter standards c++-standard-library






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 18:51







Vincent

















asked Nov 16 '18 at 18:35









VincentVincent

20.9k39135299




20.9k39135299








  • 2





    I suspect most of those predates the book of 4 book that coined the name.

    – Yakk - Adam Nevraumont
    Nov 16 '18 at 18:38











  • facade might be best. It implements a particular interface on top of an already defined thing.

    – NathanOliver
    Nov 16 '18 at 18:39











  • Fun Fact: we see the same phenomenon in the Java world with old classes like MouseAdapter. A sign of the times?

    – jaco0646
    Nov 16 '18 at 21:02











  • @jaco0646 I just looked into the old history of C++. The word adaptor for iterators was already used in 1994. For containers it's the case in 1995.

    – Vincent
    Nov 16 '18 at 22:04














  • 2





    I suspect most of those predates the book of 4 book that coined the name.

    – Yakk - Adam Nevraumont
    Nov 16 '18 at 18:38











  • facade might be best. It implements a particular interface on top of an already defined thing.

    – NathanOliver
    Nov 16 '18 at 18:39











  • Fun Fact: we see the same phenomenon in the Java world with old classes like MouseAdapter. A sign of the times?

    – jaco0646
    Nov 16 '18 at 21:02











  • @jaco0646 I just looked into the old history of C++. The word adaptor for iterators was already used in 1994. For containers it's the case in 1995.

    – Vincent
    Nov 16 '18 at 22:04








2




2





I suspect most of those predates the book of 4 book that coined the name.

– Yakk - Adam Nevraumont
Nov 16 '18 at 18:38





I suspect most of those predates the book of 4 book that coined the name.

– Yakk - Adam Nevraumont
Nov 16 '18 at 18:38













facade might be best. It implements a particular interface on top of an already defined thing.

– NathanOliver
Nov 16 '18 at 18:39





facade might be best. It implements a particular interface on top of an already defined thing.

– NathanOliver
Nov 16 '18 at 18:39













Fun Fact: we see the same phenomenon in the Java world with old classes like MouseAdapter. A sign of the times?

– jaco0646
Nov 16 '18 at 21:02





Fun Fact: we see the same phenomenon in the Java world with old classes like MouseAdapter. A sign of the times?

– jaco0646
Nov 16 '18 at 21:02













@jaco0646 I just looked into the old history of C++. The word adaptor for iterators was already used in 1994. For containers it's the case in 1995.

– Vincent
Nov 16 '18 at 22:04





@jaco0646 I just looked into the old history of C++. The word adaptor for iterators was already used in 1994. For containers it's the case in 1995.

– Vincent
Nov 16 '18 at 22:04












1 Answer
1






active

oldest

votes


















8














The word "adapter" is not used in some technical, design-pattern sense. It is used as the English word: a thing that adapts. There is no need for a more rigorous definition than that.



Container adapters modify the interface of containers. Iterator adapters modify the interface of iterators. And so forth. You're really overthinking the whole thing.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343574%2fwhat-is-an-adaptor-in-the-c-standard-how-does-it-relate-to-the-adapter-design%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    8














    The word "adapter" is not used in some technical, design-pattern sense. It is used as the English word: a thing that adapts. There is no need for a more rigorous definition than that.



    Container adapters modify the interface of containers. Iterator adapters modify the interface of iterators. And so forth. You're really overthinking the whole thing.






    share|improve this answer




























      8














      The word "adapter" is not used in some technical, design-pattern sense. It is used as the English word: a thing that adapts. There is no need for a more rigorous definition than that.



      Container adapters modify the interface of containers. Iterator adapters modify the interface of iterators. And so forth. You're really overthinking the whole thing.






      share|improve this answer


























        8












        8








        8







        The word "adapter" is not used in some technical, design-pattern sense. It is used as the English word: a thing that adapts. There is no need for a more rigorous definition than that.



        Container adapters modify the interface of containers. Iterator adapters modify the interface of iterators. And so forth. You're really overthinking the whole thing.






        share|improve this answer













        The word "adapter" is not used in some technical, design-pattern sense. It is used as the English word: a thing that adapts. There is no need for a more rigorous definition than that.



        Container adapters modify the interface of containers. Iterator adapters modify the interface of iterators. And so forth. You're really overthinking the whole thing.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 18:39









        Nicol BolasNicol Bolas

        292k34483660




        292k34483660
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53343574%2fwhat-is-an-adaptor-in-the-c-standard-how-does-it-relate-to-the-adapter-design%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma