I hear a lot about boost here and I am beginning to think it could help a lot with my software development. More so in concurrency and memory management in my particular case as we have had a lot of bugs in this area.
我在这里听到很多关于提升的内容,我开始认为它对我的软件开发有很大的帮助。在我的特定情况下,并发和内存管理更是如此,因为我们在这方面遇到了很多错误。
What are the key language features I need to polish up on to effectively benefit from using boost and to shorten the learning curve? I have seen that function objects are commonly used so I would probably need to polish up on that.
我需要进行哪些关键语言功能才能有效地从使用提升和缩短学习曲线中获益?我已经看到函数对象是常用的,所以我可能需要对它进行改进。
Additionally, are there any tutorials and 101 resources I can quickly look at to just get a feel and understanding on using boost.
另外,是否有任何教程和101个资源我可以快速查看以获得对使用boost的感觉和理解。
I realise there is a lot boost offers and I have to pick the right tools for the right job but any leads will help.
我意识到有很多提升优惠,我必须为正确的工作选择合适的工具,但任何线索都会有所帮助。
Related
- How to learn boost (no longer valid; HTTP return status 404)
如何学习提升(不再有效; HTTP返回状态404)
7 个解决方案
#1
Boost has an unimaginable number of libraries. Easy ones to get started on are
Boost拥有难以想象的数量的库。容易上手的是
- noncopyable
- array
- circular_buffer
- foreach
- operators (one of my personal favorites)
- smart_ptr
- date_time
运营商(我个人最喜欢的)之一
More advanced ones include
更高级的包括
- lambda
- bind
- iostreams
- serialization
- threads
Getting used to boost takes time, but I assure you it will make your life much better. Plus, looking at how the boost libraries are coded will help you get better at c++ coding, especially templates.
习惯提升需要时间,但我向你保证它会让你的生活更美好。另外,查看增强库的编码方式将有助于您更好地进行c ++编码,尤其是模板。
You mentioned what should you look up before trying boost. I agree that function objects are a great thing to research. Also, make sure to look up about template programming. A common problem to make sure you know is when to use the typename
qualifier for dependent types. For the most part, however, the libraries are very well documented, with examples and reference materials.
你提到在尝试提升之前你应该注意什么。我同意功能对象是一个很好的研究方法。另外,请务必查看模板编程。确保您知道的常见问题是何时将typename限定符用于依赖类型。然而,在大多数情况下,这些库都有很好的文档记录,包括示例和参考资料。
#2
Learning boost is discussed here. As for language features that are useful? All of them. C++ is a dangerous language to use if you don't know enough of it. RAII, functors/function objects and templates probably cover the most important aspects. Boost is designed similarly to the STL, so knowing your standard library is essential. Boost itself uses a lot of template metaprogramming, but as a library user, you won't often need that (unless you start playing with Boost.MPL)
这里讨论学习提升。至于有用的语言功能?他们都是。如果你对C ++知之甚少,C ++是一种危险的语言。 RAII,仿函数/函数对象和模板可能涵盖了最重要的方面。 Boost的设计与STL类似,因此了解您的标准库至关重要。 Boost本身使用了很多模板元编程,但作为库用户,你不会经常需要它(除非你开始使用Boost.MPL)
Bugs related to memory management are a good indicator that it's C++, rather than Boost you need to brush up on. The techniques for handling memory safely are well known, and not specific to Boost. (With the obvious exception of Boost's smart pointers). RAII is probably the most important concept to understand to deal with this kind of issues.
与内存管理相关的错误是一个很好的指标,它是C ++,而不是你需要提升的Boost。安全处理内存的技术是众所周知的,并不是Boost特有的。 (除了Boost的智能指针之外)。对于处理这类问题,RAII可能是最重要的理解概念。
#3
What are the key language features I need to polish up on to effectively benefit from using boost and to shorten the learning curve?
我需要进行哪些关键语言功能才能有效地从使用提升和缩短学习曲线中获益?
- Templates
- Functors
- Exceptions
- STL
- Iterators
- Algorithms
- Containers
STL迭代器算法容器
... among others.
......等等。
are there any tutorials and 101 resources I can quickly look at to just get a feel and understanding on using boost.
有没有任何教程和101资源我可以快速查看,以获得使用boost的感觉和理解。
Boost is well documented. Start here.
Boost有很好的记录。从这里开始。
There are too many libraries to get lost. I'd say start with something simple, maybe smart pointers or Boost.Test (Unit Test framework) -- which will quickly help you get started. Also, try to think of a problem you cannot solve with the STL easily. Then look up Boost documentation or post here.
有太多的图书馆迷路了。我会说一些简单的东西,可能是智能指针或Boost.Test(单元测试框架) - 这将很快帮助您入门。另外,试着想一下你用STL无法轻易解决的问题。然后查找Boost文档或在此处发布。
If you are comfortable with functional programming look at MPL/Lambda libraries.
如果您对函数式编程感到满意,请查看MPL / Lambda库。
#4
The first ting IMO are smart pointers. Integration into new code is simple, and usually not a problem for existing code. They make memory management easy, and work for many other ressources, too.
第一个IMO是智能指针。集成到新代码中很简单,对于现有代码通常不是问题。它们使内存管理变得简单,并且可以用于许多其他资源。
C++ gives you the power to manage your own memory, smart pointers let you (mostly) wing it when you don't need to.
C ++为您提供了管理自己内存的能力,智能指针可以让您(大部分)在您不需要的时候为它提供支持。
The second would be - as you mentioned - function objects, they close a big gap within C++ that is traditionally solved through inheritance, which is to strong of a coupling in many cases.
第二个是 - 如你所提到的 - 函数对象,它们在C ++中填补了传统上通过继承解决的巨大空白,这在许多情况下是强耦合的。
I have only little experience with boost outside these two, but most of the remainder is fairly "situational" - you may or may not need it. Get an overview over the libraries, and see what you need.
我对这两个之外的提升只有很少的经验,但其余大部分是相当“情境化的” - 你可能需要也可能不需要它。了解库,了解您的需求。
boost::any
and boost::variant
are good of you need a variant data type, with two different approaches.
boost :: any和boost :: variant是好的你需要一个变量数据类型,有两种不同的方法。
boost::regex
if you need some text parsing.
boost :: regex如果你需要一些文本解析。
boost::thread
and boost::filesystem
help you write portable code. If you already have good platform specific libraries, you might not need them - but they are better than API or C++ level in any case.
boost :: thread和boost :: filesystem帮助您编写可移植代码。如果您已经拥有良好的平台特定库,则可能不需要它们 - 但它们在任何情况下都优于API或C ++级别。
Maybe you like my introduction to boost smart pointers, and a rather unorthodox use for them.
也许你喜欢我的介绍,以提高智能指针,并为他们提供相当不正统的用途。
#5
Try Björn Karlsson's book: Beyond the C++ Standard Library: An Introduction to Boost. Its pretty straightforward and easy to grasp. I read this after I'd finished Scott Meyers three c++ books (effective series).
试试BjörnKarlsson的书:超越C ++标准库:Boost简介。它非常简单易懂。在我完成Scott Meyers的三本c ++书籍(有效系列)后,我读到了这本书。
#6
After reading Beyond the C++ Standard Library: An Introduction to Boost, I would recommend casually browsing the documentation on boost.org, just to get an idea of what's available. You can do a deep dive into a specific boost library when it looks like a good fit for a particular application.
在阅读了超越C ++标准库:Boost简介之后,我建议随便浏览boost.org上的文档,只是为了了解可用的内容。当它看起来非常适合特定的应用程序时,您可以深入了解特定的boost库。
#7
I think shared_ptr sould be the easiest place to start . Start using it inplaces of simple pointer or auto_ptr data types.
我认为shared_ptr可能是最容易开始的地方。开始在简单指针或auto_ptr数据类型的位置使用它。
You can also look into weak_ptr.
您还可以查看weak_ptr。
#1
Boost has an unimaginable number of libraries. Easy ones to get started on are
Boost拥有难以想象的数量的库。容易上手的是
- noncopyable
- array
- circular_buffer
- foreach
- operators (one of my personal favorites)
- smart_ptr
- date_time
运营商(我个人最喜欢的)之一
More advanced ones include
更高级的包括
- lambda
- bind
- iostreams
- serialization
- threads
Getting used to boost takes time, but I assure you it will make your life much better. Plus, looking at how the boost libraries are coded will help you get better at c++ coding, especially templates.
习惯提升需要时间,但我向你保证它会让你的生活更美好。另外,查看增强库的编码方式将有助于您更好地进行c ++编码,尤其是模板。
You mentioned what should you look up before trying boost. I agree that function objects are a great thing to research. Also, make sure to look up about template programming. A common problem to make sure you know is when to use the typename
qualifier for dependent types. For the most part, however, the libraries are very well documented, with examples and reference materials.
你提到在尝试提升之前你应该注意什么。我同意功能对象是一个很好的研究方法。另外,请务必查看模板编程。确保您知道的常见问题是何时将typename限定符用于依赖类型。然而,在大多数情况下,这些库都有很好的文档记录,包括示例和参考资料。
#2
Learning boost is discussed here. As for language features that are useful? All of them. C++ is a dangerous language to use if you don't know enough of it. RAII, functors/function objects and templates probably cover the most important aspects. Boost is designed similarly to the STL, so knowing your standard library is essential. Boost itself uses a lot of template metaprogramming, but as a library user, you won't often need that (unless you start playing with Boost.MPL)
这里讨论学习提升。至于有用的语言功能?他们都是。如果你对C ++知之甚少,C ++是一种危险的语言。 RAII,仿函数/函数对象和模板可能涵盖了最重要的方面。 Boost的设计与STL类似,因此了解您的标准库至关重要。 Boost本身使用了很多模板元编程,但作为库用户,你不会经常需要它(除非你开始使用Boost.MPL)
Bugs related to memory management are a good indicator that it's C++, rather than Boost you need to brush up on. The techniques for handling memory safely are well known, and not specific to Boost. (With the obvious exception of Boost's smart pointers). RAII is probably the most important concept to understand to deal with this kind of issues.
与内存管理相关的错误是一个很好的指标,它是C ++,而不是你需要提升的Boost。安全处理内存的技术是众所周知的,并不是Boost特有的。 (除了Boost的智能指针之外)。对于处理这类问题,RAII可能是最重要的理解概念。
#3
What are the key language features I need to polish up on to effectively benefit from using boost and to shorten the learning curve?
我需要进行哪些关键语言功能才能有效地从使用提升和缩短学习曲线中获益?
- Templates
- Functors
- Exceptions
- STL
- Iterators
- Algorithms
- Containers
STL迭代器算法容器
... among others.
......等等。
are there any tutorials and 101 resources I can quickly look at to just get a feel and understanding on using boost.
有没有任何教程和101资源我可以快速查看,以获得使用boost的感觉和理解。
Boost is well documented. Start here.
Boost有很好的记录。从这里开始。
There are too many libraries to get lost. I'd say start with something simple, maybe smart pointers or Boost.Test (Unit Test framework) -- which will quickly help you get started. Also, try to think of a problem you cannot solve with the STL easily. Then look up Boost documentation or post here.
有太多的图书馆迷路了。我会说一些简单的东西,可能是智能指针或Boost.Test(单元测试框架) - 这将很快帮助您入门。另外,试着想一下你用STL无法轻易解决的问题。然后查找Boost文档或在此处发布。
If you are comfortable with functional programming look at MPL/Lambda libraries.
如果您对函数式编程感到满意,请查看MPL / Lambda库。
#4
The first ting IMO are smart pointers. Integration into new code is simple, and usually not a problem for existing code. They make memory management easy, and work for many other ressources, too.
第一个IMO是智能指针。集成到新代码中很简单,对于现有代码通常不是问题。它们使内存管理变得简单,并且可以用于许多其他资源。
C++ gives you the power to manage your own memory, smart pointers let you (mostly) wing it when you don't need to.
C ++为您提供了管理自己内存的能力,智能指针可以让您(大部分)在您不需要的时候为它提供支持。
The second would be - as you mentioned - function objects, they close a big gap within C++ that is traditionally solved through inheritance, which is to strong of a coupling in many cases.
第二个是 - 如你所提到的 - 函数对象,它们在C ++中填补了传统上通过继承解决的巨大空白,这在许多情况下是强耦合的。
I have only little experience with boost outside these two, but most of the remainder is fairly "situational" - you may or may not need it. Get an overview over the libraries, and see what you need.
我对这两个之外的提升只有很少的经验,但其余大部分是相当“情境化的” - 你可能需要也可能不需要它。了解库,了解您的需求。
boost::any
and boost::variant
are good of you need a variant data type, with two different approaches.
boost :: any和boost :: variant是好的你需要一个变量数据类型,有两种不同的方法。
boost::regex
if you need some text parsing.
boost :: regex如果你需要一些文本解析。
boost::thread
and boost::filesystem
help you write portable code. If you already have good platform specific libraries, you might not need them - but they are better than API or C++ level in any case.
boost :: thread和boost :: filesystem帮助您编写可移植代码。如果您已经拥有良好的平台特定库,则可能不需要它们 - 但它们在任何情况下都优于API或C ++级别。
Maybe you like my introduction to boost smart pointers, and a rather unorthodox use for them.
也许你喜欢我的介绍,以提高智能指针,并为他们提供相当不正统的用途。
#5
Try Björn Karlsson's book: Beyond the C++ Standard Library: An Introduction to Boost. Its pretty straightforward and easy to grasp. I read this after I'd finished Scott Meyers three c++ books (effective series).
试试BjörnKarlsson的书:超越C ++标准库:Boost简介。它非常简单易懂。在我完成Scott Meyers的三本c ++书籍(有效系列)后,我读到了这本书。
#6
After reading Beyond the C++ Standard Library: An Introduction to Boost, I would recommend casually browsing the documentation on boost.org, just to get an idea of what's available. You can do a deep dive into a specific boost library when it looks like a good fit for a particular application.
在阅读了超越C ++标准库:Boost简介之后,我建议随便浏览boost.org上的文档,只是为了了解可用的内容。当它看起来非常适合特定的应用程序时,您可以深入了解特定的boost库。
#7
I think shared_ptr sould be the easiest place to start . Start using it inplaces of simple pointer or auto_ptr data types.
我认为shared_ptr可能是最容易开始的地方。开始在简单指针或auto_ptr数据类型的位置使用它。
You can also look into weak_ptr.
您还可以查看weak_ptr。