Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Which project Template for STL coding?

Which project Template for STL coding?

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionlearning
16 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Software2007
    wrote on last edited by
    #1

    I have been doing MFC coding. I am learning to do some STL lately, which Template project is the best for STL coding? is it ATL? Thanks

    CPalliniC M L D 5 Replies Last reply
    0
    • S Software2007

      I have been doing MFC coding. I am learning to do some STL lately, which Template project is the best for STL coding? is it ATL? Thanks

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      (If I got you) You may do whatever project you like (even MFC!) using profitably the STL library. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      S 1 Reply Last reply
      0
      • CPalliniC CPallini

        (If I got you) You may do whatever project you like (even MFC!) using profitably the STL library. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        S Offline
        S Offline
        Software2007
        wrote on last edited by
        #3

        Yes. Even though I did some STL, vectors and Lists coding within MFC, I ran into no problems there. However, I do see on the web lots of talk about not mixing the two up, so I was wondering about the ideal situation for STL. Thank you

        M 1 Reply Last reply
        0
        • S Software2007

          I have been doing MFC coding. I am learning to do some STL lately, which Template project is the best for STL coding? is it ATL? Thanks

          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          Any C++ project will do fine. No need for ATL. you just have to include necessary headers in stdafx.h.

          Watched code never compiles.

          1 Reply Last reply
          0
          • S Software2007

            Yes. Even though I did some STL, vectors and Lists coding within MFC, I ran into no problems there. However, I do see on the web lots of talk about not mixing the two up, so I was wondering about the ideal situation for STL. Thank you

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #5

            There might be some situations where you need to use a MFC collection because an existing MFC API needs it, but that's quite rare. In general, STL is very friendly with different kind of C++ environments.

            Watched code never compiles.

            1 Reply Last reply
            0
            • S Software2007

              I have been doing MFC coding. I am learning to do some STL lately, which Template project is the best for STL coding? is it ATL? Thanks

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              STL is the C++ Standard Template Library and it offers a number of useful facilities for coding in C++. It has no connection with either MFC or ATL, both of which are concerned with Windows Programming. Spend some time learning STL and how to apply it to your applications, whether they are console, ATL Windows, Win32 Windows or MFC Windows.

              Just say 'NO' to evaluated arguments for diadic functions! Ash

              S A 2 Replies Last reply
              0
              • L Lost User

                STL is the C++ Standard Template Library and it offers a number of useful facilities for coding in C++. It has no connection with either MFC or ATL, both of which are concerned with Windows Programming. Spend some time learning STL and how to apply it to your applications, whether they are console, ATL Windows, Win32 Windows or MFC Windows.

                Just say 'NO' to evaluated arguments for diadic functions! Ash

                S Offline
                S Offline
                Software2007
                wrote on last edited by
                #7

                All good answers. I will spend some time learning STL.

                1 Reply Last reply
                0
                • L Lost User

                  STL is the C++ Standard Template Library and it offers a number of useful facilities for coding in C++. It has no connection with either MFC or ATL, both of which are concerned with Windows Programming. Spend some time learning STL and how to apply it to your applications, whether they are console, ATL Windows, Win32 Windows or MFC Windows.

                  Just say 'NO' to evaluated arguments for diadic functions! Ash

                  A Offline
                  A Offline
                  Ajay Vijayvargiya
                  wrote on last edited by
                  #8

                  Other than CString (and not std::string) I use STL for everything else. std::string is terribly bad! For non-MFC project, you just need to include atlstr.h for CString (no DLL required).

                  L 1 Reply Last reply
                  0
                  • S Software2007

                    I have been doing MFC coding. I am learning to do some STL lately, which Template project is the best for STL coding? is it ATL? Thanks

                    D Offline
                    D Offline
                    dazfuller
                    wrote on last edited by
                    #9

                    I tend to use the console application template and start by removing everything I don't want, so CLR support, stdafx.h etc...

                    1 Reply Last reply
                    0
                    • S Software2007

                      I have been doing MFC coding. I am learning to do some STL lately, which Template project is the best for STL coding? is it ATL? Thanks

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      if you want to use std::string, the best way to get into that is to redefine your string type with something like this: typedef std::basic_string, std::allocator > tstring; typedef std::basic_stringstream, std::allocator > tstringstream; using it you dont have to worry if using unicode or ansy character sets it's really useful!

                      Saludos!! ____Juan

                      E 1 Reply Last reply
                      0
                      • L Lost User

                        if you want to use std::string, the best way to get into that is to redefine your string type with something like this: typedef std::basic_string, std::allocator > tstring; typedef std::basic_stringstream, std::allocator > tstringstream; using it you dont have to worry if using unicode or ansy character sets it's really useful!

                        Saludos!! ____Juan

                        E Offline
                        E Offline
                        Emilio Garavaglia
                        wrote on last edited by
                        #11

                        Beware useing <and > in messages, since HTML mess them up! I try to rewrite your message properly. Correct me if I misinterpret. "
                        if you want to use std::string, the best way to get into that is to redefine your string type with something like this:

                        typedef std::basic_string<TCHAR,std::allocator<TCHAR> >tstring;
                        typedef std::basic_stringstream<TCHAR, std::allocator<TCHAR> > tstringstream;

                        using it you dont have to worry if using unicode or ansy character sets "

                        2 bugs found. > recompile ... 65534 bugs found. :doh:

                        1 Reply Last reply
                        0
                        • A Ajay Vijayvargiya

                          Other than CString (and not std::string) I use STL for everything else. std::string is terribly bad! For non-MFC project, you just need to include atlstr.h for CString (no DLL required).

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #12

                          Ajay Vijayvargiya wrote:

                          std::string is terribly bad!

                          I'd be interested to know why, especially as I do not have access to MFC.

                          Just say 'NO' to evaluated arguments for diadic functions! Ash

                          A 1 Reply Last reply
                          0
                          • L Lost User

                            Ajay Vijayvargiya wrote:

                            std::string is terribly bad!

                            I'd be interested to know why, especially as I do not have access to MFC.

                            Just say 'NO' to evaluated arguments for diadic functions! Ash

                            A Offline
                            A Offline
                            Ajay Vijayvargiya
                            wrote on last edited by
                            #13

                            Richard MacCutchan wrote:

                            I'd be interested to know why, especially as I do not have access to MFC.

                            For one, it does not support direct conversion to plain C-style strings. You must call set of methods. It does not support Format/sprintf type of functions, not methods to convert to upper/lower, methods to trim, convert from Unicode/ANSI string and things that should be part of a good "string manipulation class". See wxString, which I prefer over CString!

                            N 1 Reply Last reply
                            0
                            • A Ajay Vijayvargiya

                              Richard MacCutchan wrote:

                              I'd be interested to know why, especially as I do not have access to MFC.

                              For one, it does not support direct conversion to plain C-style strings. You must call set of methods. It does not support Format/sprintf type of functions, not methods to convert to upper/lower, methods to trim, convert from Unicode/ANSI string and things that should be part of a good "string manipulation class". See wxString, which I prefer over CString!

                              N Offline
                              N Offline
                              Nemanja Trifunovic
                              wrote on last edited by
                              #14

                              Ajay Vijayvargiya wrote:

                              For one, it does not support direct conversion to plain C-style strings

                              Which is good, because it saves you from a whole class of subtle bugs. Explicit conversion is always better than implicit. Having said that, I don't like std::string either - it is an example of monolithic design[^]. But that does not mean CString is any better.

                              utf8-cpp

                              A A 2 Replies Last reply
                              0
                              • N Nemanja Trifunovic

                                Ajay Vijayvargiya wrote:

                                For one, it does not support direct conversion to plain C-style strings

                                Which is good, because it saves you from a whole class of subtle bugs. Explicit conversion is always better than implicit. Having said that, I don't like std::string either - it is an example of monolithic design[^]. But that does not mean CString is any better.

                                utf8-cpp

                                A Offline
                                A Offline
                                Alain Rist
                                wrote on last edited by
                                #15

                                Nemanja Trifunovic wrote:

                                an example of monolithic design[^]

                                Excellent article, thanks, AR

                                When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

                                1 Reply Last reply
                                0
                                • N Nemanja Trifunovic

                                  Ajay Vijayvargiya wrote:

                                  For one, it does not support direct conversion to plain C-style strings

                                  Which is good, because it saves you from a whole class of subtle bugs. Explicit conversion is always better than implicit. Having said that, I don't like std::string either - it is an example of monolithic design[^]. But that does not mean CString is any better.

                                  utf8-cpp

                                  A Offline
                                  A Offline
                                  Ajay Vijayvargiya
                                  wrote on last edited by
                                  #16

                                  Nemanja Trifunovic wrote:

                                  Which is good, because it saves you from a whole class of subtle bugs. Explicit conversion is always better than implicit.

                                  Heard of this umpteen number of times, but doesn't appease me at all. I am using a string-class for string, a text, and in C/C++ code it is supposed to mix with C-Style strings. The conversion is implicit to C-string and not from a C-string. You cannot assign a CString to char*/``wchar_t*, the compiler wont be happy. If you say you can put into const char*, and then do forceful conversion, then my friend, you are placing the so called "bug" by yourself. I mean, what a vector<char> would be called other than std::string? A good string-class must have string operations. Even in case, I wont have access to CString, I would write my own string-class, or download code written by some expert, instead of using this absurd std::string!

                                  Nemanja Trifunovic wrote:

                                  But that does not mean CString is any better.

                                  Any better, compared to what?

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups