| 1 | // boost_bug.cpp : Defines the entry point for the console application.
|
|---|
| 2 | //
|
|---|
| 3 |
|
|---|
| 4 | #include "stdafx.h"
|
|---|
| 5 | #include <vector>
|
|---|
| 6 | #include "boost/foreach.hpp"
|
|---|
| 7 |
|
|---|
| 8 | class Item
|
|---|
| 9 | {
|
|---|
| 10 |
|
|---|
| 11 | };
|
|---|
| 12 |
|
|---|
| 13 | class TestClass
|
|---|
| 14 | {
|
|---|
| 15 | public:
|
|---|
| 16 | typedef std::vector<Item*> ItemContainer;
|
|---|
| 17 |
|
|---|
| 18 | long getIndex (const Item* searchItem) const
|
|---|
| 19 | {
|
|---|
| 20 | long index = 0;
|
|---|
| 21 | BOOST_FOREACH (Item* n, *mCollection)
|
|---|
| 22 | {
|
|---|
| 23 | if (searchItem == n) return index;
|
|---|
| 24 | ++index;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | return -1;
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | private:
|
|---|
| 31 | ItemContainer* mCollection;
|
|---|
| 32 | };
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | int _tmain(int argc, _TCHAR* argv[])
|
|---|
| 37 | {
|
|---|
| 38 | return 0;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|